home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / elm / elm2.4.p23d.Z / elm2.4.p23d
Encoding:
Text File  |  1993-09-26  |  85.8 KB  |  2,749 lines

  1. Subject: elm 2.4 Patch #23d
  2. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  3. Priority: HIGH
  4.  
  5. THIS IS PART 4 OF A 5 PART PATCH
  6.  
  7. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  8.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  9.     If you don't have the patch program, apply the following by hand,
  10.     or get patch (version 2.0, latest patchlevel).
  11.  
  12.     After patching:
  13.         Apply patches 23e next
  14.  
  15.     If patch indicates that patchlevel is the wrong version, you may need
  16.     to apply one or more previous patches, or the patch may already
  17.     have been applied.  See the patchlevel.h file to find out what has or
  18.     has not been applied.  In any event, don't continue with the patch.
  19.  
  20.     If you are missing previous patches they can be obtained from our:
  21.     archive server.
  22.  
  23.     Syd Weinstein
  24.     elm@DSI.COM
  25.  
  26.     The patches are available from the dsinc archive server
  27.     Send the following message to archive-server@DSI.COM for
  28.     a list of available patches:
  29.  
  30.     Subject: patch list
  31.     send index elm
  32.  
  33. Index: src/elm.c
  34. Prereq: 5.14
  35. *** ../elm2.4/src/elm.c    Mon May 31 15:32:20 1993
  36. --- src/elm.c    Sun Sep 19 19:46:01 1993
  37. ***************
  38. *** 1,8 ****
  39.   
  40. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.14 1993/05/31 19:32:20 syd Exp $";
  41.   
  42.   /*******************************************************************************
  43. !  *  The Elm Mail System  -  $Revision: 5.14 $   $State: Exp $
  44.    *
  45.    * This file and all associated files and documentation:
  46.    *            Copyright (c) 1988-1992 USENET Community Trust
  47. --- 1,8 ----
  48.   
  49. ! static char rcsid[] = "@(#)$Id: elm.c,v 5.16 1993/09/19 23:46:00 syd Exp $";
  50.   
  51.   /*******************************************************************************
  52. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  53.    *
  54.    * This file and all associated files and documentation:
  55.    *            Copyright (c) 1988-1992 USENET Community Trust
  56. ***************
  57. *** 15,20 ****
  58. --- 15,37 ----
  59.    *
  60.    *******************************************************************************
  61.    * $Log: elm.c,v $
  62. +  * Revision 5.16  1993/09/19  23:46:00  syd
  63. +  * Although it doesnt solve the limit/resync problem of new
  64. +  * messages, allow them to be accessed anyway.
  65. +  * From: austig@solan.unit.no
  66. +  *
  67. +  * Revision 5.15  1993/08/03  19:28:39  syd
  68. +  * Elm tries to replace the system toupper() and tolower() on current
  69. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  70. +  * collide during linking with routines in isctype.o.  This patch adds
  71. +  * a Configure test to determine whether replacements are really needed
  72. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  73. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  74. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  75. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  76. +  * were dropped.
  77. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  78. +  *
  79.    * Revision 5.14  1993/05/31  19:32:20  syd
  80.    * With this patch build_address() should treat local mailing
  81.    * lists and other aliases known by the transport agent as valid
  82. ***************
  83. *** 103,112 ****
  84.   #endif
  85.   #ifdef BSD
  86.   #  include <sys/timeb.h>
  87. - #undef        toupper
  88. - #undef        tolower
  89.   #endif
  90.   
  91.   long bytes();
  92. --- 120,125 ----
  93. ***************
  94. *** 199,204 ****
  95. --- 212,220 ----
  96.           clear_error();
  97.           header_page = pageon;
  98.   
  99. +         if (selected)               /* update count of selected messages */
  100. +           selected += message_count - last_in_folder;
  101.           if (on_page(current))   /* do we REALLY have to rewrite? */
  102.             showscreen();
  103.           else {
  104.  
  105. Index: src/expires.c
  106. Prereq: 5.2
  107. *** ../elm2.4/src/expires.c    Sun Dec  6 21:59:02 1992
  108. --- src/expires.c    Tue Aug 10 14:53:31 1993
  109. ***************
  110. *** 1,8 ****
  111.   
  112. ! static char rcsid[] = "@(#)$Id: expires.c,v 5.2 1992/12/07 02:58:56 syd Exp $";
  113.   
  114.   /*******************************************************************************
  115. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  116.    *
  117.    *            Copyright (c) 1988-1992 USENET Community Trust
  118.    *            Copyright (c) 1986,1987 Dave Taylor
  119. --- 1,8 ----
  120.   
  121. ! static char rcsid[] = "@(#)$Id: expires.c,v 5.4 1993/08/10 18:53:31 syd Exp $";
  122.   
  123.   /*******************************************************************************
  124. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  125.    *
  126.    *            Copyright (c) 1988-1992 USENET Community Trust
  127.    *            Copyright (c) 1986,1987 Dave Taylor
  128. ***************
  129. *** 14,19 ****
  130. --- 14,36 ----
  131.    *
  132.    *******************************************************************************
  133.    * $Log: expires.c,v $
  134. +  * Revision 5.4  1993/08/10  18:53:31  syd
  135. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  136. +  * some reads of unitialized memory.
  137. +  * From: vogt@isa.de
  138. +  *
  139. +  * Revision 5.3  1993/08/03  19:28:39  syd
  140. +  * Elm tries to replace the system toupper() and tolower() on current
  141. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  142. +  * collide during linking with routines in isctype.o.  This patch adds
  143. +  * a Configure test to determine whether replacements are really needed
  144. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  145. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  146. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  147. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  148. +  * were dropped.
  149. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  150. +  *
  151.    * Revision 5.2  1992/12/07  02:58:56  syd
  152.    * Fix long -> time_t
  153.    * From: Syd
  154. ***************
  155. *** 39,51 ****
  156.   #  include <sys/time.h>
  157.   #endif
  158.   
  159. - #include <ctype.h>
  160. - #ifdef BSD
  161. - #undef toupper
  162. - #undef tolower
  163. - #endif
  164.   process_expiration_date(date, message_status)
  165.   char *date;
  166.   int  *message_status;
  167. --- 56,61 ----
  168. ***************
  169. *** 53,59 ****
  170.       struct tm *timestruct;
  171.       time_t thetime;
  172.       char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
  173. !     int  month = 0, day = 0, year = 0, hour = 0, minute = 0;
  174.   #ifndef    _POSIX_SOURCE
  175.       struct tm *localtime();
  176.       time_t time();
  177. --- 63,69 ----
  178.       struct tm *timestruct;
  179.       time_t thetime;
  180.       char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
  181. !     int  month = 0, day = 0, year = 0, hour = 0, minute = 0, items;
  182.   #ifndef    _POSIX_SOURCE
  183.       struct tm *localtime();
  184.       time_t time();
  185. ***************
  186. *** 77,84 ****
  187.           so is the first field the month or the day?  Standard prob.
  188.       **/
  189.   
  190. !     sscanf(date, "%s %s %s %s %s",
  191. !         word1, word2, word3, word4, word5);
  192.   
  193.       if (strlen(word5) != 0) {    /* we have form #7 */
  194.         day   = atoi(word1);
  195. --- 87,105 ----
  196.           so is the first field the month or the day?  Standard prob.
  197.       **/
  198.   
  199. !     items = sscanf(date, "%s %s %s %s %s",
  200. !                word1, word2, word3, word4, word5);
  201. !     if (items < 5)
  202. !       word5[0] = '\0';
  203. !     if (items < 4)
  204. !       word4[0] = '\0';
  205. !     if (items < 3)
  206. !       word3[0] = '\0';
  207. !     if (items < 2)
  208. !       word2[0] = '\0';
  209. !     if (items < 1)
  210. !       word1[0] = '\0';
  211.   
  212.       if (strlen(word5) != 0) {    /* we have form #7 */
  213.         day   = atoi(word1);
  214.  
  215. Index: src/file.c
  216. Prereq: 5.20
  217. *** ../elm2.4/src/file.c    Thu May 13 23:57:38 1993
  218. --- src/file.c    Tue Aug  3 15:29:06 1993
  219. ***************
  220. *** 1,8 ****
  221.   
  222. ! static char rcsid[] = "@(#)$Id: file.c,v 5.20 1993/05/14 03:57:36 syd Exp $";
  223.   
  224.   /*******************************************************************************
  225. !  *  The Elm Mail System  -  $Revision: 5.20 $   $State: Exp $
  226.    *
  227.    *            Copyright (c) 1988-1992 USENET Community Trust
  228.    *            Copyright (c) 1986,1987 Dave Taylor
  229. --- 1,8 ----
  230.   
  231. ! static char rcsid[] = "@(#)$Id: file.c,v 5.21 1993/08/03 19:28:39 syd Exp $";
  232.   
  233.   /*******************************************************************************
  234. !  *  The Elm Mail System  -  $Revision: 5.21 $   $State: Exp $
  235.    *
  236.    *            Copyright (c) 1988-1992 USENET Community Trust
  237.    *            Copyright (c) 1986,1987 Dave Taylor
  238. ***************
  239. *** 14,19 ****
  240. --- 14,31 ----
  241.    *
  242.    *******************************************************************************
  243.    * $Log: file.c,v $
  244. +  * Revision 5.21  1993/08/03  19:28:39  syd
  245. +  * Elm tries to replace the system toupper() and tolower() on current
  246. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  247. +  * collide during linking with routines in isctype.o.  This patch adds
  248. +  * a Configure test to determine whether replacements are really needed
  249. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  250. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  251. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  252. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  253. +  * were dropped.
  254. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  255. +  *
  256.    * Revision 5.20  1993/05/14  03:57:36  syd
  257.    * A couple of calls to want_to() had typos. Here is the patch.
  258.    * From: Jukka Ukkonen <ukkonen@csc.fi>
  259. ***************
  260. *** 139,151 ****
  261.   #endif
  262.   
  263.   #include "s_elm.h"
  264. - #include <ctype.h>
  265.   #include <errno.h>
  266.   
  267. - #ifdef BSD
  268. - #undef tolower
  269. - #endif
  270.   extern int errno;
  271.   
  272.   char *nameof();
  273. --- 151,158 ----
  274.  
  275. Index: src/file_util.c
  276. Prereq: 5.6
  277. *** ../elm2.4/src/file_util.c    Wed Feb  3 14:06:48 1993
  278. --- src/file_util.c    Sun Sep 26 21:51:57 1993
  279. ***************
  280. *** 1,8 ****
  281.   
  282. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.6 1993/02/03 19:06:31 syd Exp $";
  283.   
  284.   /*******************************************************************************
  285. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  286.    *
  287.    *            Copyright (c) 1988-1992 USENET Community Trust
  288.    *            Copyright (c) 1986,1987 Dave Taylor
  289. --- 1,8 ----
  290.   
  291. ! static char rcsid[] = "@(#)$Id: file_util.c,v 5.10 1993/09/27 01:51:38 syd Exp $";
  292.   
  293.   /*******************************************************************************
  294. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  295.    *
  296.    *            Copyright (c) 1988-1992 USENET Community Trust
  297.    *            Copyright (c) 1986,1987 Dave Taylor
  298. ***************
  299. *** 14,19 ****
  300. --- 14,46 ----
  301.    *
  302.    *******************************************************************************
  303.    * $Log: file_util.c,v $
  304. +  * Revision 5.10  1993/09/27  01:51:38  syd
  305. +  * Add elm_chown to consolidate for Xenix not allowing -1
  306. +  * From: Syd
  307. +  *
  308. +  * Revision 5.9  1993/09/19  23:37:29  syd
  309. +  * I found a few places more where the code was missing a call
  310. +  * to fflush() before it called unlock() and fclose()/exit()
  311. +  * right after unlocking the mail drop.
  312. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  313. +  *
  314. +  * Revision 5.8  1993/08/23  03:26:24  syd
  315. +  * Try setting group id separate from user id in chown to
  316. +  * allow restricted systems to change group id of file
  317. +  * From: Syd
  318. +  *
  319. +  * Revision 5.7  1993/08/03  19:28:39  syd
  320. +  * Elm tries to replace the system toupper() and tolower() on current
  321. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  322. +  * collide during linking with routines in isctype.o.  This patch adds
  323. +  * a Configure test to determine whether replacements are really needed
  324. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  325. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  326. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  327. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  328. +  * were dropped.
  329. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  330. +  *
  331.    * Revision 5.6  1993/02/03  19:06:31  syd
  332.    * Remove extra strchr/strcat/strcpy et al declarations
  333.    * From: Syd
  334. ***************
  335. *** 49,61 ****
  336.   #include "headers.h"
  337.   #include "s_elm.h"
  338.   #include <sys/stat.h>
  339. - #include <ctype.h>
  340. - #include <errno.h>
  341. - #ifdef BSD
  342. - # undef tolower
  343. - #endif
  344.   #include <errno.h>
  345.   
  346.   #ifdef BSD
  347. --- 76,81 ----
  348. ***************
  349. *** 112,151 ****
  350.       FILE *from_file, *to_file;
  351.       char buffer[VERY_LONG_STRING];
  352.       int  len;
  353. !     
  354.       if ((from_file = fopen(from, "r")) == NULL) {
  355. !       dprint(1, (debugfile, "Error: could not open %s for reading (copy)\n",
  356. !          from));
  357. !       error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
  358. !         "Could not open file %s."), from);
  359. !       return(1);
  360.       }
  361.   
  362.       if ((to_file = fopen(to, "w")) == NULL) {
  363. !       dprint(1, (debugfile, "Error: could not open %s for writing (copy)\n",
  364. !          to));
  365. !       error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
  366. !         "Could not open file %s."), to);
  367. !       return(1);
  368.       }
  369.   
  370. !     while (len = fread(buffer, 1, VERY_LONG_STRING, from_file))
  371. !       if (fwrite(buffer, 1, len, to_file) != len) {
  372. !           Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopy,
  373. !               "\n\rWrite failed to temp file in copy\n\r"), 0);
  374. !           perror(to);
  375. !           fclose(to_file);
  376. !           fclose(from_file);
  377. !           return(1);
  378. !       }
  379.       fclose(from_file);
  380. !         if (fclose(to_file) == EOF) {
  381. !       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCloseFailedCopy,
  382. !           "\n\rClose failed on temp file in copy\n\r"), 0);
  383. !       perror(to);
  384. !       return(1);
  385.       }
  386. !     chown( to, userid, groupid);
  387.   
  388.       return(0);
  389.   }
  390. --- 132,183 ----
  391.       FILE *from_file, *to_file;
  392.       char buffer[VERY_LONG_STRING];
  393.       int  len;
  394. !     dprint (1, (debugfile, "Copy: from='%s' to='%s'\n", from, to));
  395.       if ((from_file = fopen(from, "r")) == NULL) {
  396. !         dprint(1, (debugfile, "Error: could not open %s for reading (copy)\n",
  397. !                from));
  398. !         error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
  399. !                "Could not open file %s."), from);
  400. !         return(1);
  401.       }
  402.   
  403.       if ((to_file = fopen(to, "w")) == NULL) {
  404. !         dprint(1, (debugfile, "Error: could not open %s for writing (copy)\n",
  405. !                to));
  406. !         error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
  407. !                "Could not open file %s."), to);
  408. !         return(1);
  409.       }
  410.   
  411. !     while (len = fread(buffer, 1, VERY_LONG_STRING, from_file)) {
  412. !         if (fwrite(buffer, 1, len, to_file) != len) {
  413. !         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopy,
  414. !             "\n\rWrite failed to temp file in copy\n\r"), 0);
  415. !         perror(to);
  416. !         /*
  417. !          *  NEVER close anything just at whim!!
  418. !          *  If the file has been locked using fcntl() or lockf()
  419. !          *    YOU WILL DROP ALL LOCKS refering to the file.
  420. !          */
  421. !         fflush(to_file);
  422. !         fclose(to_file);
  423. !         fclose(from_file);
  424. !         return(1);
  425. !         }
  426. !     }
  427.       fclose(from_file);
  428. !     fflush(to_file);
  429. !     if (fclose(to_file) == EOF) {
  430. !         Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCloseFailedCopy,
  431. !             "\n\rClose failed on temp file in copy\n\r"), 0);
  432. !         perror(to);
  433. !         return(1);
  434.       }
  435. !     (void) elm_chown( to, userid, groupid);
  436.   
  437.       return(0);
  438.   }
  439.  
  440. Index: src/fileio.c
  441. Prereq: 5.8
  442. *** ../elm2.4/src/fileio.c    Mon Feb  8 13:38:12 1993
  443. --- src/fileio.c    Sun Sep 26 21:51:58 1993
  444. ***************
  445. *** 1,8 ****
  446.   
  447. ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.8 1993/02/08 18:38:12 syd Exp $";
  448.   
  449.   /*******************************************************************************
  450. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  451.    *
  452.    *            Copyright (c) 1988-1992 USENET Community Trust
  453.    *            Copyright (c) 1986,1987 Dave Taylor
  454. --- 1,8 ----
  455.   
  456. ! static char rcsid[] = "@(#)$Id: fileio.c,v 5.14 1993/09/27 01:51:38 syd Exp $";
  457.   
  458.   /*******************************************************************************
  459. !  *  The Elm Mail System  -  $Revision: 5.14 $   $State: Exp $
  460.    *
  461.    *            Copyright (c) 1988-1992 USENET Community Trust
  462.    *            Copyright (c) 1986,1987 Dave Taylor
  463. ***************
  464. *** 14,19 ****
  465. --- 14,52 ----
  466.    *
  467.    *******************************************************************************
  468.    * $Log: fileio.c,v $
  469. +  * Revision 5.14  1993/09/27  01:51:38  syd
  470. +  * Add elm_chown to consolidate for Xenix not allowing -1
  471. +  * From: Syd
  472. +  *
  473. +  * Revision 5.13  1993/09/19  23:15:52  syd
  474. +  * Here's some more patch stuff for undersize buffers for header lines.
  475. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  476. +  *
  477. +  * Revision 5.12  1993/08/23  12:28:23  syd
  478. +  * Fix placement of ifdef for PC_CHOWN
  479. +  * From: syd
  480. +  *
  481. +  * Revision 5.11  1993/08/23  03:26:24  syd
  482. +  * Try setting group id separate from user id in chown to
  483. +  * allow restricted systems to change group id of file
  484. +  * From: Syd
  485. +  *
  486. +  * Revision 5.10  1993/08/10  20:29:52  syd
  487. +  * add PC_CHOWN_RESTRICTED where needed
  488. +  * From: Syd
  489. +  *
  490. +  * Revision 5.9  1993/08/03  19:28:39  syd
  491. +  * Elm tries to replace the system toupper() and tolower() on current
  492. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  493. +  * collide during linking with routines in isctype.o.  This patch adds
  494. +  * a Configure test to determine whether replacements are really needed
  495. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  496. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  497. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  498. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  499. +  * were dropped.
  500. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  501. +  *
  502.    * Revision 5.8  1993/02/08  18:38:12  syd
  503.    * Fix to copy_file to ignore unescaped from if content_length not yet reached.
  504.    * Fixes to NLS messages match number of newlines between default messages
  505. ***************
  506. *** 60,72 ****
  507.   #include "headers.h"
  508.   #include "s_elm.h"
  509.   #include <sys/stat.h>
  510. - #include <ctype.h>
  511.   #include <errno.h>
  512.   
  513. - #ifdef BSD
  514. - #undef tolower
  515. - #endif
  516.   extern int errno;
  517.   
  518.   char *error_description();
  519. --- 93,100 ----
  520. ***************
  521. *** 106,112 ****
  522.           else just copy it as it is.
  523.       **/
  524.   
  525. !     char buffer[SLEN];
  526.       register struct header_rec *current_header = headers[current-1];
  527.       register int  lines, front_line, next_front,
  528.             in_header = 1, first_line = TRUE, ignoring = FALSE;
  529. --- 134,147 ----
  530.           else just copy it as it is.
  531.       **/
  532.   
  533. !     /*
  534. !      *    Changed buffer[SLEN] to buffer[VERY_LONG_STRING] to make it
  535. !      *    big enough to contain a full length header line. Any header
  536. !      *    is allowed to be at least 1024 bytes in length. (r.t.f. RFC)
  537. !      *    14-Sep-1993 Jukka Ukkonen <ukkonen@csc.fi>
  538. !      */
  539. !     char buffer[VERY_LONG_STRING];
  540.       register struct header_rec *current_header = headers[current-1];
  541.       register int  lines, front_line, next_front,
  542.             in_header = 1, first_line = TRUE, ignoring = FALSE;
  543. ***************
  544. *** 151,157 ****
  545.       next_front = TRUE;
  546.   
  547.       while (lines) {
  548. !       if ((buf_len = mail_gets(buffer, SLEN, mailfile)) == 0)
  549.           break;
  550.   
  551.         bytes_seen += buf_len;
  552. --- 186,192 ----
  553.       next_front = TRUE;
  554.   
  555.       while (lines) {
  556. !       if (! (buf_len = mail_gets(buffer, VERY_LONG_STRING, mailfile)))
  557.           break;
  558.   
  559.         bytes_seen += buf_len;
  560. ***************
  561. *** 362,368 ****
  562.   }
  563.   
  564.   static struct stat saved_buf;
  565. ! static char saved_fname[SLEN];
  566.   
  567.   int
  568.   save_file_stats(fname)
  569. --- 397,410 ----
  570.   }
  571.   
  572.   static struct stat saved_buf;
  573. ! /*
  574. !  *  Don't take chances that a file name is really longer than SLEN.
  575. !  *  You'll just pollute the memory right after the allocated space
  576. !  *  if you have MAXPATHLEN of 1024 (_PATH_MAX in POSIX).
  577. !  */
  578. ! static char saved_fname[VERY_LONG_STRING];
  579.   
  580.   int
  581.   save_file_stats(fname)
  582. ***************
  583. *** 427,440 ****
  584.       /*
  585.        * Chown is restricted to root on BSD unix
  586.        */
  587. !     (void) chown(fname, new_owner, new_group);
  588.   #else
  589. !     if((i = chown(fname, new_owner, new_group)) == -1)
  590. !       ret_code = -1;
  591. !     dprint(2, (debugfile, "** chown(%s, %d, %d) returns %d [errno=%d] **\n",
  592. !            fname, new_owner, new_group, i, errno));
  593. ! #endif
  594.   
  595.       return(ret_code);
  596.   
  597. --- 469,495 ----
  598.       /*
  599.        * Chown is restricted to root on BSD unix
  600.        */
  601. !     (void) elm_chown(fname, new_owner, new_group);
  602.   #else
  603. ! #  ifdef _PC_CHOWN_RESTRICTED
  604. ! /*
  605. !  * Chown may or may not be restricted to root in SVR4, if it is,
  606. !  *    then need to copy must be true, and no restore of permissions
  607. !  *    should be performed.
  608. !  */
  609. !         if (!pathconf(fname, _PC_CHOWN_RESTRICTED)) {
  610. ! #  endif
  611. !         if((i = elm_chown(fname, new_owner, new_group)) == -1)
  612. !         ret_code = -1;
  613. !         dprint(2, (debugfile, "** elm_chown(%s, %d, %d) returns %d [errno=%d] **\n",
  614. !                fname, new_owner, new_group, i, errno));
  615. ! #  ifdef _PC_CHOWN_RESTRICTED
  616. !     } else {
  617. !         (void) elm_chown(fname, new_owner, new_group);
  618. !     }
  619. ! #  endif /* _PC_CHOWN_RESTRICTED */
  620. ! #endif /* BSD */
  621.   
  622.       return(ret_code);
  623.   
  624. ***************
  625. *** 452,465 ****
  626.          'hidden users' on the system.
  627.       **/
  628.       
  629. !     FILE *hidden_users;
  630. !     char  buffer[SLEN];
  631.   
  632. !         /* 
  633.       this line is deliberately inserted to ensure that you THINK
  634.       about what you're doing, and perhaps even contact the author
  635.       of Elm before you USE this option...
  636. !         */
  637.   
  638.       if ((hidden_users = fopen (HIDDEN_SITE_USERS,"r")) == NULL) {
  639.         dprint(1, (debugfile,
  640. --- 507,520 ----
  641.          'hidden users' on the system.
  642.       **/
  643.       
  644. !     FILE *hidden_users;
  645. !     char  buffer[VERY_LONG_STRING];
  646.   
  647. !     /* 
  648.       this line is deliberately inserted to ensure that you THINK
  649.       about what you're doing, and perhaps even contact the author
  650.       of Elm before you USE this option...
  651. !      */
  652.   
  653.       if ((hidden_users = fopen (HIDDEN_SITE_USERS,"r")) == NULL) {
  654.         dprint(1, (debugfile,
  655.  
  656. Index: src/forms.c
  657. Prereq: 5.3
  658. *** ../elm2.4/src/forms.c    Wed Feb  3 14:06:48 1993
  659. --- src/forms.c    Tue Aug  3 15:10:22 1993
  660. ***************
  661. *** 1,8 ****
  662.   
  663. ! static char rcsid[] = "@(#)$Id: forms.c,v 5.3 1993/02/03 19:06:31 syd Exp $";
  664.   
  665.   /*******************************************************************************
  666. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  667.    *
  668.    *            Copyright (c) 1988-1992 USENET Community Trust
  669.    *            Copyright (c) 1986,1987 Dave Taylor
  670. --- 1,8 ----
  671.   
  672. ! static char rcsid[] = "@(#)$Id: forms.c,v 5.4 1993/08/03 19:10:22 syd Exp $";
  673.   
  674.   /*******************************************************************************
  675. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  676.    *
  677.    *            Copyright (c) 1988-1992 USENET Community Trust
  678.    *            Copyright (c) 1986,1987 Dave Taylor
  679. ***************
  680. *** 14,19 ****
  681. --- 14,24 ----
  682.    *
  683.    *******************************************************************************
  684.    * $Log: forms.c,v $
  685. +  * Revision 5.4  1993/08/03  19:10:22  syd
  686. +  * The last character of a form field gets zapped if more characters than
  687. +  * the field expects are entered.
  688. +  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
  689. +  *
  690.    * Revision 5.3  1993/02/03  19:06:31  syd
  691.    * Remove extra strchr/strcat/strcpy et al declarations
  692.    * From: Syd
  693. ***************
  694. *** 399,403 ****
  695.       fgets(buffer, SLEN, stdin);
  696.       no_ret(buffer);
  697.   
  698. !     if (strlen(buffer) > field_size) buffer[field_size-1] = '\0';
  699.   }
  700. --- 404,408 ----
  701.       fgets(buffer, SLEN, stdin);
  702.       no_ret(buffer);
  703.   
  704. !     if (strlen(buffer) > field_size) buffer[field_size] = '\0';
  705.   }
  706.  
  707. Index: src/hdrconfg.c
  708. Prereq: 5.2
  709. *** ../elm2.4/src/hdrconfg.c    Sat Nov 21 20:15:16 1992
  710. --- src/hdrconfg.c    Tue Aug  3 15:29:09 1993
  711. ***************
  712. *** 1,8 ****
  713.   
  714. ! static char rcsid[] = "@(#)$Id: hdrconfg.c,v 5.2 1992/11/22 01:15:15 syd Exp $";
  715.   
  716.   /*******************************************************************************
  717. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  718.    *
  719.    *            Copyright (c) 1988-1992 USENET Community Trust
  720.    *            Copyright (c) 1986,1987 Dave Taylor
  721. --- 1,8 ----
  722.   
  723. ! static char rcsid[] = "@(#)$Id: hdrconfg.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  724.   
  725.   /*******************************************************************************
  726. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  727.    *
  728.    *            Copyright (c) 1988-1992 USENET Community Trust
  729.    *            Copyright (c) 1986,1987 Dave Taylor
  730. ***************
  731. *** 14,19 ****
  732. --- 14,31 ----
  733.    *
  734.    *******************************************************************************
  735.    * $Log: hdrconfg.c,v $
  736. +  * Revision 5.3  1993/08/03  19:28:39  syd
  737. +  * Elm tries to replace the system toupper() and tolower() on current
  738. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  739. +  * collide during linking with routines in isctype.o.  This patch adds
  740. +  * a Configure test to determine whether replacements are really needed
  741. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  742. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  743. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  744. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  745. +  * were dropped.
  746. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  747. +  *
  748.    * Revision 5.2  1992/11/22  01:15:15  syd
  749.    * Add on initial display or display where the entire screen is being
  750.    * drawn, we should not output the trailing blanks that clear the old
  751. ***************
  752. *** 47,59 ****
  753.   #include "headers.h"
  754.   #include "s_elm.h"
  755.   
  756. - #include <ctype.h>
  757. - #ifdef BSD
  758. - #undef toupper
  759. - #undef tolower
  760. - #endif
  761.   /*
  762.    * Placement of prompts and messages at the bottom of the screen.
  763.    */
  764. --- 59,64 ----
  765. ***************
  766. *** 572,578 ****
  767.   
  768.       c = getchar();
  769.   
  770. !     switch ((int)(isupper(c) ? tolower(c) : c)) {
  771.       case 't':
  772.           h = &hmenu_to;
  773.           break;
  774. --- 577,583 ----
  775.   
  776.       c = getchar();
  777.   
  778. !     switch (tolower(c)) {
  779.       case 't':
  780.           h = &hmenu_to;
  781.           break;
  782.  
  783. Index: src/help.c
  784. Prereq: 5.3
  785. *** ../elm2.4/src/help.c    Sun Apr 11 23:15:49 1993
  786. --- src/help.c    Tue Aug  3 15:29:09 1993
  787. ***************
  788. *** 1,8 ****
  789.   
  790. ! static char rcsid[] = "@(#)$Id: help.c,v 5.3 1993/04/12 03:15:41 syd Exp $";
  791.   
  792.   /*******************************************************************************
  793. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  794.    *
  795.    *            Copyright (c) 1988-1992 USENET Community Trust
  796.    *            Copyright (c) 1986,1987 Dave Taylor
  797. --- 1,8 ----
  798.   
  799. ! static char rcsid[] = "@(#)$Id: help.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  800.   
  801.   /*******************************************************************************
  802. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  803.    *
  804.    *            Copyright (c) 1988-1992 USENET Community Trust
  805.    *            Copyright (c) 1986,1987 Dave Taylor
  806. ***************
  807. *** 14,19 ****
  808. --- 14,31 ----
  809.    *
  810.    *******************************************************************************
  811.    * $Log: help.c,v $
  812. +  * Revision 5.4  1993/08/03  19:28:39  syd
  813. +  * Elm tries to replace the system toupper() and tolower() on current
  814. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  815. +  * collide during linking with routines in isctype.o.  This patch adds
  816. +  * a Configure test to determine whether replacements are really needed
  817. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  818. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  819. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  820. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  821. +  * were dropped.
  822. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  823. +  *
  824.    * Revision 5.3  1993/04/12  03:15:41  syd
  825.    * These patches makes 'T' (since it was free) do a Tag and Move command in the
  826.    * index and alias page, and in the builtin pager.
  827. ***************
  828. *** 35,41 ****
  829.   
  830.   ***/
  831.   
  832. - #include <ctype.h>
  833.   #include "headers.h"
  834.   #include "s_elm.h"
  835.   
  836. --- 47,52 ----
  837.  
  838. Index: src/in_utils.c
  839. Prereq: 5.11
  840. *** ../elm2.4/src/in_utils.c    Sun May 16 16:56:19 1993
  841. --- src/in_utils.c    Tue Aug  3 15:29:10 1993
  842. ***************
  843. *** 1,8 ****
  844.   
  845. ! static char rcsid[] = "@(#)$Id: in_utils.c,v 5.11 1993/05/16 20:56:18 syd Exp $";
  846.   
  847.   /*******************************************************************************
  848. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  849.    *
  850.    *            Copyright (c) 1988-1992 USENET Community Trust
  851.    *            Copyright (c) 1986,1987 Dave Taylor
  852. --- 1,8 ----
  853.   
  854. ! static char rcsid[] = "@(#)$Id: in_utils.c,v 5.13 1993/08/03 19:28:39 syd Exp $";
  855.   
  856.   /*******************************************************************************
  857. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  858.    *
  859.    *            Copyright (c) 1988-1992 USENET Community Trust
  860.    *            Copyright (c) 1986,1987 Dave Taylor
  861. ***************
  862. *** 14,19 ****
  863. --- 14,38 ----
  864.    *
  865.    *******************************************************************************
  866.    * $Log: in_utils.c,v $
  867. +  * Revision 5.13  1993/08/03  19:28:39  syd
  868. +  * Elm tries to replace the system toupper() and tolower() on current
  869. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  870. +  * collide during linking with routines in isctype.o.  This patch adds
  871. +  * a Configure test to determine whether replacements are really needed
  872. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  873. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  874. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  875. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  876. +  * were dropped.
  877. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  878. +  *
  879. +  * Revision 5.12  1993/08/03  19:10:50  syd
  880. +  * Patch for Elm 2.4 PL22 to correct handling of SIGWINCH signals on
  881. +  * DecStations with Ultrix 4.2.
  882. +  * The problem was that elm running in an xterm exits silently when the
  883. +  * window is resize. This was caused by incorrect signal handling for BSD.
  884. +  * From: vogt@isa.de
  885. +  *
  886.    * Revision 5.11  1993/05/16  20:56:18  syd
  887.    * fix want-to patch collision
  888.    * From: Jukka Ukkonen <ukkonen@csc.fi>
  889. ***************
  890. *** 84,94 ****
  891.   #include "headers.h"
  892.   #include "s_elm.h"
  893.   #include <errno.h>
  894. - #include <ctype.h>
  895. - #ifdef BSD
  896. - #  undef tolower
  897. - #endif
  898.   
  899.   extern int errno;        /* system error number */
  900.   
  901. --- 103,108 ----
  902. ***************
  903. *** 572,579 ****
  904.           alarm((unsigned) 0);
  905.         }
  906.       }
  907. !     else
  908. !       ch = ReadCh();
  909.   #else
  910.           errno = 0;    /* we actually have to do this.  *sigh*  */
  911.           ch = ReadCh();
  912. --- 586,595 ----
  913.           alarm((unsigned) 0);
  914.         }
  915.       }
  916. !     else {
  917. !         ch = ReadCh();
  918. !         if (errno == EINTR) ch = NO_OP_COMMAND;
  919. !     }
  920.   #else
  921.           errno = 0;    /* we actually have to do this.  *sigh*  */
  922.           ch = ReadCh();
  923.  
  924. Index: src/init.c
  925. Prereq: 5.16
  926. *** ../elm2.4/src/init.c    Sun Apr 11 23:30:24 1993
  927. --- src/init.c    Sun Sep 26 21:51:59 1993
  928. ***************
  929. *** 1,8 ****
  930.   
  931. ! static char rcsid[] = "@(#)$Id: init.c,v 5.16 1993/04/12 03:30:23 syd Exp $";
  932.   
  933.   /*******************************************************************************
  934. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  935.    *
  936.    *            Copyright (c) 1988-1992 USENET Community Trust
  937.    *            Copyright (c) 1986,1987 Dave Taylor
  938. --- 1,8 ----
  939.   
  940. ! static char rcsid[] = "@(#)$Id: init.c,v 5.19 1993/09/27 01:51:38 syd Exp $";
  941.   
  942.   /*******************************************************************************
  943. !  *  The Elm Mail System  -  $Revision: 5.19 $   $State: Exp $
  944.    *
  945.    *            Copyright (c) 1988-1992 USENET Community Trust
  946.    *            Copyright (c) 1986,1987 Dave Taylor
  947. ***************
  948. *** 14,19 ****
  949. --- 14,40 ----
  950.    *
  951.    *******************************************************************************
  952.    * $Log: init.c,v $
  953. +  * Revision 5.19  1993/09/27  01:51:38  syd
  954. +  * Add elm_chown to consolidate for Xenix not allowing -1
  955. +  * From: Syd
  956. +  *
  957. +  * Revision 5.18  1993/08/23  03:26:24  syd
  958. +  * Try setting group id separate from user id in chown to
  959. +  * allow restricted systems to change group id of file
  960. +  * From: Syd
  961. +  *
  962. +  * Revision 5.17  1993/08/03  19:28:39  syd
  963. +  * Elm tries to replace the system toupper() and tolower() on current
  964. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  965. +  * collide during linking with routines in isctype.o.  This patch adds
  966. +  * a Configure test to determine whether replacements are really needed
  967. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  968. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  969. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  970. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  971. +  * were dropped.
  972. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  973. +  *
  974.    * Revision 5.16  1993/04/12  03:30:23  syd
  975.    * On AIX, __STDC__ is not defined but it does use unistd.h, etc.  In
  976.    * hdrs/def.h, ANS_C already gets defined if __STDC__ or _AIX.  But this
  977. ***************
  978. *** 128,141 ****
  979.   #  include <sys/time.h>
  980.   #endif
  981.   
  982. - #include <ctype.h>
  983.   #include <errno.h>
  984.   
  985. - #ifdef BSD
  986. - #undef toupper
  987. - #undef tolower
  988. - #endif
  989.   extern int errno;        /* system error number on failure */
  990.   extern char version_buff[];
  991.   
  992. --- 149,156 ----
  993. ***************
  994. *** 273,279 ****
  995.               "Could not open file %s for debug output!\n"),
  996.             filename));
  997.         }
  998. !       chown(filename, userid, groupid); /* file owned by user */
  999.   
  1000.         fprintf(debugfile, 
  1001.        "Debug output of the ELM program (at debug level %d).  Version %s\n\n",
  1002. --- 288,294 ----
  1003.               "Could not open file %s for debug output!\n"),
  1004.             filename));
  1005.         }
  1006. !       (void) elm_chown(filename, userid, groupid); /* file owned by user */
  1007.   
  1008.         fprintf(debugfile, 
  1009.        "Debug output of the ELM program (at debug level %d).  Version %s\n\n",
  1010.  
  1011. Index: src/leavembox.c
  1012. Prereq: 5.17
  1013. *** ../elm2.4/src/leavembox.c    Mon May 31 15:47:59 1993
  1014. --- src/leavembox.c    Sun Sep 26 21:52:00 1993
  1015. ***************
  1016. *** 1,8 ****
  1017.   
  1018. ! static char rcsid[] = "@(#)$Id: leavembox.c,v 5.17 1993/05/31 19:47:45 syd Exp $";
  1019.   
  1020.   /*******************************************************************************
  1021. !  *  The Elm Mail System  -  $Revision: 5.17 $   $State: Exp $
  1022.    *
  1023.    *            Copyright (c) 1988-1992 USENET Community Trust
  1024.    *            Copyright (c) 1986,1987 Dave Taylor
  1025. --- 1,8 ----
  1026.   
  1027. ! static char rcsid[] = "@(#)$Id: leavembox.c,v 5.20 1993/09/27 01:51:38 syd Exp $";
  1028.   
  1029.   /*******************************************************************************
  1030. !  *  The Elm Mail System  -  $Revision: 5.20 $   $State: Exp $
  1031.    *
  1032.    *            Copyright (c) 1988-1992 USENET Community Trust
  1033.    *            Copyright (c) 1986,1987 Dave Taylor
  1034. ***************
  1035. *** 14,19 ****
  1036. --- 14,33 ----
  1037.    *
  1038.    *******************************************************************************
  1039.    * $Log: leavembox.c,v $
  1040. +  * Revision 5.20  1993/09/27  01:51:38  syd
  1041. +  * Add elm_chown to consolidate for Xenix not allowing -1
  1042. +  * From: Syd
  1043. +  *
  1044. +  * Revision 5.19  1993/08/23  03:26:24  syd
  1045. +  * Try setting group id separate from user id in chown to
  1046. +  * allow restricted systems to change group id of file
  1047. +  * From: Syd
  1048. +  *
  1049. +  * Revision 5.18  1993/08/03  19:59:49  syd
  1050. +  * Check for chown restricted and if so, do copyover and
  1051. +  * back to avoid need for chown
  1052. +  * From: Syd
  1053. +  *
  1054.    * Revision 5.17  1993/05/31  19:47:45  syd
  1055.    * change is_symlink to no_restore and use it for special modes as well
  1056.    * From: Syd
  1057. ***************
  1058. *** 542,548 ****
  1059.         }
  1060.         fclose(temp);
  1061.         dprint(2, (debugfile, "\n\n"));
  1062. !       chown(recvd_mail, userid, groupid);
  1063.       }
  1064.   
  1065.       /* If there are any messages to keep, first copy them to a
  1066. --- 556,562 ----
  1067.         }
  1068.         fclose(temp);
  1069.         dprint(2, (debugfile, "\n\n"));
  1070. !       (void) elm_chown(recvd_mail, userid, groupid);
  1071.       }
  1072.   
  1073.       /* If there are any messages to keep, first copy them to a
  1074. ***************
  1075. *** 689,694 ****
  1076. --- 703,722 ----
  1077.         }
  1078.   #endif
  1079.   
  1080. + #ifdef _PC_CHOWN_RESTRICTED
  1081. +       if (!need_to_copy) {
  1082. + /*
  1083. +  * Chown may or may not be restricted to root in SVR4, if it is,
  1084. +  *    then need to copy must be true, and no restore of permissions
  1085. +  *    should be performed.
  1086. +  */
  1087. +           if (pathconf(cur_folder, _PC_CHOWN_RESTRICTED)) {
  1088. +          need_to_copy = TRUE;
  1089. +          no_restore = TRUE;
  1090. +           }
  1091. +       }
  1092. + #endif  /* _PC_CHOWN_RESTRICTED */
  1093.   #ifdef SAVE_GROUP_MAILBOX_ID
  1094.         if (folder_type == SPOOL)
  1095.                 setgid(mailgroupid);
  1096.  
  1097. Index: src/mailmsg1.c
  1098. Prereq: 5.6
  1099. *** ../elm2.4/src/mailmsg1.c    Sat May  8 16:25:42 1993
  1100. --- src/mailmsg1.c    Mon Jul 19 22:46:14 1993
  1101. ***************
  1102. *** 1,8 ****
  1103.   
  1104. ! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.6 1993/05/08 20:25:33 syd Exp $";
  1105.   
  1106.   /*******************************************************************************
  1107. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  1108.    *
  1109.    *            Copyright (c) 1988-1992 USENET Community Trust
  1110.    *            Copyright (c) 1986,1987 Dave Taylor
  1111. --- 1,8 ----
  1112.   
  1113. ! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.7 1993/07/20 02:46:14 syd Exp $";
  1114.   
  1115.   /*******************************************************************************
  1116. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  1117.    *
  1118.    *            Copyright (c) 1988-1992 USENET Community Trust
  1119.    *            Copyright (c) 1986,1987 Dave Taylor
  1120. ***************
  1121. *** 14,19 ****
  1122. --- 14,23 ----
  1123.    *
  1124.    *******************************************************************************
  1125.    * $Log: mailmsg1.c,v $
  1126. +  * Revision 5.7  1993/07/20  02:46:14  syd
  1127. +  * Handle reply-to in batch mode.
  1128. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  1129. +  *
  1130.    * Revision 5.6  1993/05/08  20:25:33  syd
  1131.    * Add sleepmsg to control transient message delays
  1132.    * From: Syd
  1133. ***************
  1134. *** 207,212 ****
  1135. --- 211,217 ----
  1136.       **/
  1137.   
  1138.       int  copy_msg = FALSE, is_a_response = FALSE;
  1139. +     char *p;
  1140.   
  1141.       /* First: zero all current global message strings */
  1142.   
  1143. ***************
  1144. *** 215,233 ****
  1145.       expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
  1146.       expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
  1147.   
  1148. !     strcpy(subject, given_subject);        /* copy given subject */
  1149. !     strcpy(to, given_to);            /* copy given to:     */
  1150. !     strcpy(cc, given_cc);            /*  and so on..       */
  1151.   
  1152.       /******* And now the real stuff! *******/
  1153.   
  1154. !     copy_msg=copy_the_msg(&is_a_response); /* copy msg into edit buffer? */
  1155.   
  1156. !     if (get_to(to, expanded_to) == 0)   /* get the To: address and expand */
  1157.         return(0);
  1158. !     if ( cc[0] != '\0' )            /* expand out CC addresses */
  1159.         build_address(strip_commas(cc), expanded_cc);
  1160.   
  1161.       /** if we're batchmailing, let's send it and GET OUTTA HERE! **/
  1162.   
  1163.       if (batch_only) {
  1164. --- 220,251 ----
  1165.       expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
  1166.       expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
  1167.   
  1168. !     /* Then: fill in default values for some fields */
  1169. !     strcpy(subject, given_subject);
  1170. !     strcpy(to, given_to);
  1171. !     strcpy(cc, given_cc);
  1172. !     if ((p = getenv("REPLYTO")) != NULL)
  1173. !       strcpy(reply_to, p);
  1174.   
  1175.       /******* And now the real stuff! *******/
  1176.   
  1177. !     /* copy msg into edit buffer? */
  1178. !     copy_msg = copy_the_msg(&is_a_response);
  1179.   
  1180. !     /* get the To: address and expand */
  1181. !     if (! get_to(to, expanded_to))
  1182.         return(0);
  1183. !     /* expand the Cc: address */
  1184. !     if (cc[0])
  1185.         build_address(strip_commas(cc), expanded_cc);
  1186.   
  1187. +     /* expand the Reply-To: address */
  1188. +     if (reply_to[0])
  1189. +       build_address(strip_commas(reply_to), expanded_reply_to);
  1190.       /** if we're batchmailing, let's send it and GET OUTTA HERE! **/
  1191.   
  1192.       if (batch_only) {
  1193.  
  1194. Index: src/mailmsg2.c
  1195. Prereq: 5.30
  1196. *** ../elm2.4/src/mailmsg2.c    Sun Jun  6 14:24:48 1993
  1197. --- src/mailmsg2.c    Sun Sep 26 21:52:02 1993
  1198. ***************
  1199. *** 1,8 ****
  1200.   
  1201. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.30 1993/06/06 17:53:06 syd Exp $";
  1202.   
  1203.   /*******************************************************************************
  1204. !  *  The Elm Mail System  -  $Revision: 5.30 $   $State: Exp $
  1205.    *
  1206.    *             Copyright (c) 1988-1992 USENET Community Trust
  1207.    *             Copyright (c) 1986,1987 Dave Taylor
  1208. --- 1,8 ----
  1209.   
  1210. ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.35 1993/09/27 01:51:38 syd Exp $";
  1211.   
  1212.   /*******************************************************************************
  1213. !  *  The Elm Mail System  -  $Revision: 5.35 $   $State: Exp $
  1214.    *
  1215.    *             Copyright (c) 1988-1992 USENET Community Trust
  1216.    *             Copyright (c) 1986,1987 Dave Taylor
  1217. ***************
  1218. *** 14,19 ****
  1219. --- 14,49 ----
  1220.    *
  1221.    *******************************************************************************
  1222.    * $Log: mailmsg2.c,v $
  1223. +  * Revision 5.35  1993/09/27  01:51:38  syd
  1224. +  * Add elm_chown to consolidate for Xenix not allowing -1
  1225. +  * From: Syd
  1226. +  *
  1227. +  * Revision 5.34  1993/08/23  03:26:24  syd
  1228. +  * Try setting group id separate from user id in chown to
  1229. +  * allow restricted systems to change group id of file
  1230. +  * From: Syd
  1231. +  *
  1232. +  * Revision 5.33  1993/08/10  18:53:31  syd
  1233. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  1234. +  * some reads of unitialized memory.
  1235. +  * From: vogt@isa.de
  1236. +  *
  1237. +  * Revision 5.32  1993/08/03  19:28:39  syd
  1238. +  * Elm tries to replace the system toupper() and tolower() on current
  1239. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1240. +  * collide during linking with routines in isctype.o.  This patch adds
  1241. +  * a Configure test to determine whether replacements are really needed
  1242. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1243. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1244. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1245. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1246. +  * were dropped.
  1247. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1248. +  *
  1249. +  * Revision 5.31  1993/07/20  01:47:47  syd
  1250. +  * Fix time() declaration
  1251. +  * From: Syd via prompt from Dan Mosedale
  1252. +  *
  1253.    * Revision 5.30  1993/06/06  17:53:06  syd
  1254.    * Remove extranious clear
  1255.    * From: Chip
  1256. ***************
  1257. *** 189,200 ****
  1258.   #include "headers.h"
  1259.   #include "s_elm.h"
  1260.   #include <errno.h>
  1261. - #include <ctype.h>
  1262. - #ifdef BSD 
  1263. - #undef tolower
  1264. - #undef toupper
  1265. - #endif
  1266.   
  1267.   extern int errno;
  1268.   extern char version_buff[];
  1269. --- 219,224 ----
  1270. ***************
  1271. *** 331,337 ****
  1272.           return(need_redraw);
  1273.         }
  1274.   
  1275. !     chown (filename, userid, groupid);
  1276.   
  1277.       /* copy the message from standard input */
  1278.       if (batch_only) {
  1279. --- 355,361 ----
  1280.           return(need_redraw);
  1281.         }
  1282.   
  1283. !     (void) elm_chown(filename, userid, groupid);
  1284.   
  1285.       /* copy the message from standard input */
  1286.       if (batch_only) {
  1287. ***************
  1288. *** 612,618 ****
  1289.           mailer, mailerflags, expanded_to, whole_msg_file,
  1290.           remove_cmd, whole_msg_file);
  1291.       }
  1292. !     
  1293.       fclose(reply);
  1294.   
  1295.       if(batch_only) {
  1296. --- 636,644 ----
  1297.           mailer, mailerflags, expanded_to, whole_msg_file,
  1298.           remove_cmd, whole_msg_file);
  1299.       }
  1300. !     free(whole_msg_file);
  1301.       fclose(reply);
  1302.   
  1303.       if(batch_only) {
  1304. ***************
  1305. *** 955,961 ****
  1306.       **/
  1307.   
  1308.       char opentype[3];
  1309. !     long time(), thetime;
  1310.       char *ctime();
  1311.       static FILE *filedesc;        /* our friendly file descriptor  */
  1312.           char to_buf[VERY_LONG_STRING];
  1313. --- 981,987 ----
  1314.       **/
  1315.   
  1316.       char opentype[3];
  1317. !     time_t time(), thetime;
  1318.       char *ctime();
  1319.       static FILE *filedesc;        /* our friendly file descriptor  */
  1320.           char to_buf[VERY_LONG_STRING];
  1321.  
  1322. Index: src/mime.c
  1323. Prereq: 5.10
  1324. *** ../elm2.4/src/mime.c    Thu May 13 23:56:20 1993
  1325. --- src/mime.c    Sun Aug 22 22:55:06 1993
  1326. ***************
  1327. *** 1,5 ****
  1328.   /*******************************************************************************
  1329. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1330.    *
  1331.    *            Copyright (c) 1988-1992 USENET Community Trust
  1332.    *            Copyright (c) 1986,1987 Dave Taylor
  1333. --- 1,8 ----
  1334. + static char rcsid[] = "@(#)$Id: mime.c,v 5.15 1993/08/23 02:55:05 syd Exp $";
  1335.   /*******************************************************************************
  1336. !  *  The Elm Mail System  -  $Revision: 5.15 $   $State: Exp $
  1337.    *
  1338.    *            Copyright (c) 1988-1992 USENET Community Trust
  1339.    *            Copyright (c) 1986,1987 Dave Taylor
  1340. ***************
  1341. *** 11,16 ****
  1342. --- 14,66 ----
  1343.    *
  1344.    ******************************************************************************
  1345.    * $Log: mime.c,v $
  1346. +  * Revision 5.15  1993/08/23  02:55:05  syd
  1347. +  * Add missing parens
  1348. +  * From: dwolfe@pffft.sps.mot.com (Dave Wolfe)
  1349. +  *
  1350. +  * Revision 5.14  1993/08/10  18:53:31  syd
  1351. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  1352. +  * some reads of unitialized memory.
  1353. +  * From: vogt@isa.de
  1354. +  *
  1355. +  * Revision 5.13  1993/08/03  19:28:39  syd
  1356. +  * Elm tries to replace the system toupper() and tolower() on current
  1357. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1358. +  * collide during linking with routines in isctype.o.  This patch adds
  1359. +  * a Configure test to determine whether replacements are really needed
  1360. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1361. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1362. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1363. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1364. +  * were dropped.
  1365. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1366. +  *
  1367. +  * Revision 5.12  1993/07/20  02:41:24  syd
  1368. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  1369. +  * have it return an error code instead of bailing out, and add a buffer
  1370. +  * size argument to avoid overwritting the destination.  The first is to
  1371. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  1372. +  * forgot to go through) to protect the value handed to expand_env().
  1373. +  * The second is because expand_env() was originally written to support
  1374. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  1375. +  * in the other places where it has since been used.  The third is just
  1376. +  * a matter of practicing safe source code.
  1377. +  *
  1378. +  * This patch changes all invocations to expand_env() to eliminate making
  1379. +  * temporary copies (now that the routine is non-destructive) and to pass
  1380. +  * in a destination length.  Since expand_env() no longer bails out on
  1381. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  1382. +  * this.  Moreover, the error message now gives some indication of what
  1383. +  * the problem is rather than just saying "can't expand".
  1384. +  *
  1385. +  * Gratitous change to src/editmsg.c renaming filename variables to
  1386. +  * clarify the purpose.
  1387. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1388. +  *
  1389. +  * Revision 5.11  1993/06/10  03:12:10  syd
  1390. +  * Add missing rcs id lines
  1391. +  * From: Syd
  1392. +  *
  1393.    * Revision 5.10  1993/05/14  03:56:19  syd
  1394.    * A MIME body-part must end with a newline even when there was no newline
  1395.    * at the end of the actual body or the body is null. Otherwise the next
  1396. ***************
  1397. *** 73,79 ****
  1398.   #ifdef MIME
  1399.   
  1400.   #include <errno.h>
  1401. - #include <ctype.h>
  1402.   #include <sys/stat.h>
  1403.   
  1404.   int check_for_multipart(filedesc)
  1405. --- 123,128 ----
  1406. ***************
  1407. *** 148,154 ****
  1408.           sleep(sleepmsg);
  1409.       return(-1);
  1410.     }
  1411. !   expand_env(Expanded_Filename, Include_Filename);
  1412.   
  1413.     if (strlen(Content_Type) == 0) {
  1414.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
  1415. --- 197,203 ----
  1416.           sleep(sleepmsg);
  1417.       return(-1);
  1418.     }
  1419. !   (void) expand_env(Expanded_Filename, Include_Filename, sizeof(Expanded_Filename));
  1420.   
  1421.     if (strlen(Content_Type) == 0) {
  1422.       Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
  1423. ***************
  1424. *** 272,278 ****
  1425.       if (!s) return(1);
  1426.       while (*s && isspace(*s)) ++s;
  1427.       t = buf;
  1428. !     while (*s && !isspace(*s) && ((t-buf) < SLEN)) *t++ = *s++;
  1429.       EncType = check_encoding(buf);
  1430.       if ((EncType == ENCODING_NONE) ||
  1431.           (EncType == ENCODING_7BIT) ||
  1432. --- 321,328 ----
  1433.       if (!s) return(1);
  1434.       while (*s && isspace(*s)) ++s;
  1435.       t = buf;
  1436. !     while (*s && !isspace(*s) && ((t-buf) < (SLEN-1))) *t++ = *s++;
  1437. !     *t = '\0';
  1438.       EncType = check_encoding(buf);
  1439.       if ((EncType == ENCODING_NONE) ||
  1440.           (EncType == ENCODING_7BIT) ||
  1441.  
  1442. Index: src/newmbox.c
  1443. Prereq: 5.26
  1444. *** ../elm2.4/src/newmbox.c    Thu May 13 23:55:14 1993
  1445. --- src/newmbox.c    Sun Sep 26 21:52:06 1993
  1446. ***************
  1447. *** 1,8 ****
  1448.   
  1449. ! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.26 1993/05/14 03:55:13 syd Exp $";
  1450.   
  1451.   /*******************************************************************************
  1452. !  *  The Elm Mail System  -  $Revision: 5.26 $   $State: Exp $
  1453.    *
  1454.    *            Copyright (c) 1988-1992 USENET Community Trust
  1455.    *            Copyright (c) 1986,1987 Dave Taylor
  1456. --- 1,8 ----
  1457.   
  1458. ! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.34 1993/09/27 01:51:38 syd Exp $";
  1459.   
  1460.   /*******************************************************************************
  1461. !  *  The Elm Mail System  -  $Revision: 5.34 $   $State: Exp $
  1462.    *
  1463.    *            Copyright (c) 1988-1992 USENET Community Trust
  1464.    *            Copyright (c) 1986,1987 Dave Taylor
  1465. ***************
  1466. *** 14,19 ****
  1467. --- 14,63 ----
  1468.    *
  1469.    *******************************************************************************
  1470.    * $Log: newmbox.c,v $
  1471. +  * Revision 5.34  1993/09/27  01:51:38  syd
  1472. +  * Add elm_chown to consolidate for Xenix not allowing -1
  1473. +  * From: Syd
  1474. +  *
  1475. +  * Revision 5.33  1993/09/19  23:38:16  syd
  1476. +  * Erroneous Content-Length:s that ended up beyond the end of the folder
  1477. +  * wasn't checked for, so the rest of the folder became one big message.
  1478. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1479. +  *
  1480. +  * Revision 5.32  1993/09/19  23:32:35  syd
  1481. +  * Fix a code portability problem with Convex.
  1482. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1483. +  *
  1484. +  * Revision 5.31  1993/09/19  23:15:28  syd
  1485. +  * Changed a few buffers from LONG_STRING (512) to VERY_LONG_STRING
  1486. +  * to avoid long header lines overflowing the allocated space. At
  1487. +  * least 1024 bytes should be allowed in any header line/field.
  1488. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1489. +  *
  1490. +  * Revision 5.30  1993/08/23  03:26:24  syd
  1491. +  * Try setting group id separate from user id in chown to
  1492. +  * allow restricted systems to change group id of file
  1493. +  * From: Syd
  1494. +  *
  1495. +  * Revision 5.29  1993/08/23  02:46:51  syd
  1496. +  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  1497. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  1498. +  *
  1499. +  * Revision 5.28  1993/08/03  19:28:39  syd
  1500. +  * Elm tries to replace the system toupper() and tolower() on current
  1501. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1502. +  * collide during linking with routines in isctype.o.  This patch adds
  1503. +  * a Configure test to determine whether replacements are really needed
  1504. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1505. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1506. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1507. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1508. +  * were dropped.
  1509. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1510. +  *
  1511. +  * Revision 5.27  1993/07/20  15:32:36  syd
  1512. +  * no dprint should be at level 0
  1513. +  * From: Syd
  1514. +  *
  1515.    * Revision 5.26  1993/05/14  03:55:13  syd
  1516.    * The recent feature addition for the "readmsginc" variable did not modify
  1517.    * the output statement that is used when MMDF is defined.  The following
  1518. ***************
  1519. *** 144,157 ****
  1520.   
  1521.   /**  read new folder **/
  1522.   
  1523. - #include <ctype.h>
  1524.   #include "headers.h"
  1525.   #include "s_elm.h"
  1526.   
  1527. - #ifdef BSD
  1528. - #undef tolower        /* we have our own "tolower" routine instead! */
  1529. - #endif
  1530.   #include <sys/stat.h>
  1531.   #include <errno.h>
  1532.   
  1533. --- 188,196 ----
  1534. ***************
  1535. *** 166,172 ****
  1536.   
  1537.   char *error_description();
  1538.   long bytes();
  1539. ! #ifndef __STDC__ /* avoid problemswith systems that declare atol as a macro */
  1540.   extern void rewind();
  1541.   extern long atol();
  1542.   #endif
  1543. --- 205,211 ----
  1544.   
  1545.   char *error_description();
  1546.   long bytes();
  1547. ! #ifndef ANSI_C /* avoid problems with systems that declare atol as a macro */
  1548.   extern void rewind();
  1549.   extern long atol();
  1550.   #endif
  1551. ***************
  1552. *** 361,367 ****
  1553.   
  1554.       FILE *temp;
  1555.       struct header_rec *current_header = NULL;
  1556. !     char buffer[LONG_STRING], tbuffer[LONG_STRING], *c;
  1557.       long fbytes = 0L, line_bytes = 0L, content_start = 0L,
  1558.         content_remaining = -1L, lines_start = 0L;
  1559.       register long line = 0;
  1560. --- 400,406 ----
  1561.   
  1562.       FILE *temp;
  1563.       struct header_rec *current_header = NULL;
  1564. !     char buffer[VERY_LONG_STRING], tbuffer[VERY_LONG_STRING], *c;
  1565.       long fbytes = 0L, line_bytes = 0L, content_start = 0L,
  1566.         content_remaining = -1L, lines_start = 0L;
  1567.       register long line = 0;
  1568. ***************
  1569. *** 406,412 ****
  1570.            rm_temps_exit();
  1571.           }
  1572.          copyit++;
  1573. !        chown(cur_tempfolder, userid, groupid);
  1574.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  1575.        }
  1576.        else {
  1577. --- 445,451 ----
  1578.            rm_temps_exit();
  1579.           }
  1580.          copyit++;
  1581. !        (void) elm_chown(cur_tempfolder, userid, groupid);
  1582.          chmod(cur_tempfolder, 0700);    /* shut off file for other people! */
  1583.        }
  1584.        else {
  1585. ***************
  1586. *** 498,504 ****
  1587.   
  1588.       while (fbytes < mailfile_size) {
  1589.   
  1590. !       if ((line_bytes = mail_gets(buffer, LONG_STRING, mailfile)) == 0)
  1591.           break;
  1592.   
  1593.         if (copyit)
  1594. --- 537,543 ----
  1595.   
  1596.       while (fbytes < mailfile_size) {
  1597.   
  1598. !       if ((line_bytes = mail_gets(buffer, VERY_LONG_STRING, mailfile)) == 0)
  1599.           break;
  1600.   
  1601.         if (copyit)
  1602. ***************
  1603. *** 705,711 ****
  1604.            * reading headers of new messages that have just arrived,
  1605.            * and the preceding message was one of the old ones.
  1606.            */
  1607. !         if ((count) && (!add_new_only || count > message_count)) {
  1608.             headers[count-1]->lines = line;
  1609.             if (headers[count-1]->content_length < 0)
  1610.               headers[count-1]->content_length = fbytes - content_start;
  1611. --- 744,750 ----
  1612.            * reading headers of new messages that have just arrived,
  1613.            * and the preceding message was one of the old ones.
  1614.            */
  1615. !         if (count && (!add_new_only || (count > message_count))) {
  1616.             headers[count-1]->lines = line;
  1617.             if (headers[count-1]->content_length < 0)
  1618.               headers[count-1]->content_length = fbytes - content_start;
  1619. ***************
  1620. *** 825,831 ****
  1621.           else if (header_cmp(buffer, "Content-Length", NULL)) {
  1622.             buffer[line_bytes - 1] = '\0';
  1623.             current_header->content_length = atol((char *) buffer + 15);
  1624. !           content_length_found = TRUE;
  1625.           }
  1626.   
  1627.           else if (header_cmp(buffer, "Expires", NULL))
  1628. --- 864,875 ----
  1629.           else if (header_cmp(buffer, "Content-Length", NULL)) {
  1630.             buffer[line_bytes - 1] = '\0';
  1631.             current_header->content_length = atol((char *) buffer + 15);
  1632. !           /* Check if content_length is > remaining size of file */
  1633. !           if (current_header->content_length > mailfile_size-fbytes)
  1634. !         current_header->content_length = -1;
  1635. !           else
  1636. !             content_length_found = TRUE;
  1637.           }
  1638.   
  1639.           else if (header_cmp(buffer, "Expires", NULL))
  1640. ***************
  1641. *** 975,981 ****
  1642.            Raw(OFF);
  1643.            printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
  1644.              "\nnewmbox - length of mbox. != spool mailbox length!!\n"));
  1645. !         dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
  1646.           rm_temps_exit();
  1647.         }
  1648.         if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
  1649. --- 1019,1025 ----
  1650.            Raw(OFF);
  1651.            printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
  1652.              "\nnewmbox - length of mbox. != spool mailbox length!!\n"));
  1653. !         dprint(1, (debugfile, "newmbox - mbox. != spool mail length"));
  1654.           rm_temps_exit();
  1655.         }
  1656.         if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
  1657.  
  1658. Index: src/options.c
  1659. Prereq: 5.12
  1660. *** ../elm2.4/src/options.c    Sat May  8 16:25:47 1993
  1661. --- src/options.c    Tue Aug  3 15:29:15 1993
  1662. ***************
  1663. *** 1,8 ****
  1664.   
  1665. ! static char rcsid[] = "@(#)$Id: options.c,v 5.12 1993/05/08 20:25:33 syd Exp $";
  1666.   
  1667.   /*******************************************************************************
  1668. !  *  The Elm Mail System  -  $Revision: 5.12 $   $State: Exp $
  1669.    *
  1670.    *             Copyright (c) 1986,1987 Dave Taylor
  1671.    *             Copyright (c) 1988-1992 USENET Community Trust
  1672. --- 1,8 ----
  1673.   
  1674. ! static char rcsid[] = "@(#)$Id: options.c,v 5.16 1993/08/03 19:28:39 syd Exp $";
  1675.   
  1676.   /*******************************************************************************
  1677. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  1678.    *
  1679.    *             Copyright (c) 1986,1987 Dave Taylor
  1680.    *             Copyright (c) 1988-1992 USENET Community Trust
  1681. ***************
  1682. *** 14,19 ****
  1683. --- 14,71 ----
  1684.    *
  1685.    *******************************************************************************
  1686.    * $Log: options.c,v $
  1687. +  * Revision 5.16  1993/08/03  19:28:39  syd
  1688. +  * Elm tries to replace the system toupper() and tolower() on current
  1689. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1690. +  * collide during linking with routines in isctype.o.  This patch adds
  1691. +  * a Configure test to determine whether replacements are really needed
  1692. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1693. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1694. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1695. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1696. +  * were dropped.
  1697. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1698. +  *
  1699. +  * Revision 5.15  1993/07/20  02:41:24  syd
  1700. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  1701. +  * have it return an error code instead of bailing out, and add a buffer
  1702. +  * size argument to avoid overwritting the destination.  The first is to
  1703. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  1704. +  * forgot to go through) to protect the value handed to expand_env().
  1705. +  * The second is because expand_env() was originally written to support
  1706. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  1707. +  * in the other places where it has since been used.  The third is just
  1708. +  * a matter of practicing safe source code.
  1709. +  *
  1710. +  * This patch changes all invocations to expand_env() to eliminate making
  1711. +  * temporary copies (now that the routine is non-destructive) and to pass
  1712. +  * in a destination length.  Since expand_env() no longer bails out on
  1713. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  1714. +  * this.  Moreover, the error message now gives some indication of what
  1715. +  * the problem is rather than just saying "can't expand".
  1716. +  *
  1717. +  * Gratitous change to src/editmsg.c renaming filename variables to
  1718. +  * clarify the purpose.
  1719. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1720. +  *
  1721. +  * Revision 5.14  1993/06/12  05:32:00  syd
  1722. +  * fix calling sequence for new argument
  1723. +  * From: Syd
  1724. +  *
  1725. +  * Revision 5.13  1993/06/10  03:07:39  syd
  1726. +  * This fixes a bug in the MIME code.  Include_Part() uses expand_env()
  1727. +  * to expand the include file name, but since expand_env() is destructive
  1728. +  * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
  1729. +  * header can contain a bogus value.  The easy fix would be a one-line
  1730. +  * hack to Include_Part to use a temporary buffer.  This patch does not
  1731. +  * implement the easy fix.  *Every* place expand_env() is used, its side
  1732. +  * effects cause problems.  I think the right fix is to make expand_env()
  1733. +  * non-destructive (i.e. have it duplicate the input to a temporary buffer
  1734. +  * and work from there).  The attached patch modifies expand_env() in
  1735. +  * that manner, and eliminates all of the `copy to a temporary buffer'
  1736. +  * calls that precede it throughout elm.
  1737. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1738. +  *
  1739.    * Revision 5.12  1993/05/08  20:25:33  syd
  1740.    * Add sleepmsg to control transient message delays
  1741.    * From: Syd
  1742. ***************
  1743. *** 120,129 ****
  1744.   #include "save_opts.h"
  1745.   #include "s_elm.h"
  1746.   
  1747. - #ifdef BSD
  1748. - #undef tolower
  1749. - #endif
  1750.   #undef onoff
  1751.   #define   onoff(n)    (n == 1? on_name : off_name)
  1752.   
  1753. --- 172,177 ----
  1754. ***************
  1755. *** 133,154 ****
  1756.   static char *on_name = NULL;
  1757.   static char *off_name = NULL;
  1758.   static int resort = 0;
  1759. ! static char temp[SLEN];    /* needed when an option is run through
  1760. !              * expand_env(), because that function
  1761. !              * is destructive of the original
  1762. !              */
  1763. ! static post_cal(f) int f; {strcpy(temp,raw_calendar_file); expand_env(calendar_file,temp);}
  1764. ! static post_editor(f) int f; {strcpy(temp,raw_editor); expand_env(editor,temp);}
  1765. ! static post_pager(f) int f; {
  1766. !     strcpy(temp, raw_pager); expand_env(pager, temp);
  1767. !     clear_pages=(equal(pager,"builtin+")||equal(pager,"internal+"));
  1768. !     }
  1769. ! static post_folder(f) int f; {strcpy(temp,raw_folders); expand_env(folders,temp);}
  1770. ! static post_sort(f) int f; {if (f) resort++;}
  1771. ! static post_sent(f) int f; {strcpy(temp,raw_sentmail); expand_env(sent_mail,temp);}
  1772. ! static post_print(f) int f; {strcpy(temp,raw_printout); expand_env(printout,temp);}
  1773. ! static post_menu(f) int f; {headers_per_page=LINES-(mini_menu?13:8);}
  1774.   
  1775.   opts_menu cfg_opts[] = {
  1776.   
  1777. --- 181,237 ----
  1778.   static char *on_name = NULL;
  1779.   static char *off_name = NULL;
  1780.   static int resort = 0;
  1781. ! static post_cal(f)
  1782. ! int f;
  1783. ! {
  1784. !     (void) expand_env(calendar_file, raw_calendar_file, sizeof(calendar_file));
  1785. ! }
  1786. ! static post_editor(f)
  1787. ! int f;
  1788. ! {
  1789. !     (void) expand_env(editor, raw_editor, sizeof(editor));
  1790. ! }
  1791. ! static post_pager(f)
  1792. ! int f;
  1793. ! {
  1794. !     (void) expand_env(pager, raw_pager, sizeof(pager));
  1795. !     clear_pages = (equal(pager, "builtin+") || equal(pager, "internal+"));
  1796. ! }
  1797. ! static post_folder(f)
  1798. ! int f;
  1799. ! {
  1800. !     (void) expand_env(folders, raw_folders, sizeof(folders));
  1801. ! }
  1802. ! static post_sort(f)
  1803. ! int f;
  1804. ! {
  1805. !     if (f)
  1806. !     resort++;
  1807. ! }
  1808. ! static post_sent(f)
  1809. ! int f;
  1810. ! {
  1811. !     (void) expand_env(sent_mail, raw_sentmail, sizeof(sent_mail));
  1812. ! }
  1813. ! static post_print(f)
  1814. ! int f;
  1815. ! {
  1816. !     (void) expand_env(printout, raw_printout, sizeof(printout));
  1817. ! }
  1818. ! static post_menu(f)
  1819. ! int f;
  1820. ! {
  1821. !     headers_per_page = LINES - (mini_menu ? 13 : 8);
  1822. ! }
  1823.   
  1824.   opts_menu cfg_opts[] = {
  1825.   
  1826. ***************
  1827. *** 689,695 ****
  1828.         if (sleepmsg > 0)
  1829.           sleep((sleepmsg + 1) / 2);
  1830.         main_state();
  1831. !       sort_aliases(message_count, FALSE);
  1832.         main_state();
  1833.       }
  1834.       ClearLine(LINES-2);        /* clear alias_sort_one_liner()! */
  1835. --- 772,778 ----
  1836.         if (sleepmsg > 0)
  1837.           sleep((sleepmsg + 1) / 2);
  1838.         main_state();
  1839. !       sort_aliases(message_count, FALSE, FALSE);
  1840.         main_state();
  1841.       }
  1842.       ClearLine(LINES-2);        /* clear alias_sort_one_liner()! */
  1843.  
  1844. Index: src/pattern.c
  1845. Prereq: 5.9
  1846. *** ../elm2.4/src/pattern.c    Thu May 13 23:53:50 1993
  1847. --- src/pattern.c    Sun Sep 19 19:15:30 1993
  1848. ***************
  1849. *** 1,8 ****
  1850.   
  1851. ! static char rcsid[] = "@(#)$Id: pattern.c,v 5.9 1993/05/14 03:53:46 syd Exp $";
  1852.   
  1853.   /*******************************************************************************
  1854. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  1855.    *
  1856.    *            Copyright (c) 1988-1992 USENET Community Trust
  1857.    *            Copyright (c) 1986,1987 Dave Taylor
  1858. --- 1,8 ----
  1859.   
  1860. ! static char rcsid[] = "@(#)$Id: pattern.c,v 5.10 1993/09/19 23:15:28 syd Exp $";
  1861.   
  1862.   /*******************************************************************************
  1863. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  1864.    *
  1865.    *            Copyright (c) 1988-1992 USENET Community Trust
  1866.    *            Copyright (c) 1986,1987 Dave Taylor
  1867. ***************
  1868. *** 14,19 ****
  1869. --- 14,25 ----
  1870.    *
  1871.    *******************************************************************************
  1872.    * $Log: pattern.c,v $
  1873. +  * Revision 5.10  1993/09/19  23:15:28  syd
  1874. +  * Changed a few buffers from LONG_STRING (512) to VERY_LONG_STRING
  1875. +  * to avoid long header lines overflowing the allocated space. At
  1876. +  * least 1024 bytes should be allowed in any header line/field.
  1877. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1878. +  *
  1879.    * Revision 5.9  1993/05/14  03:53:46  syd
  1880.    * Fix wrong message being displayed and then overwritten
  1881.    * for long aliases.
  1882. ***************
  1883. *** 394,400 ****
  1884.           Returns 1 if found, 0 if not
  1885.       **/
  1886.   
  1887. !     char buffer[LONG_STRING];
  1888.       int  message_number, lines, line, line_len, err;
  1889.   
  1890.       message_number = current-1;
  1891. --- 400,406 ----
  1892.           Returns 1 if found, 0 if not
  1893.       **/
  1894.   
  1895. !     char buffer[VERY_LONG_STRING];
  1896.       int  message_number, lines, line, line_len, err;
  1897.   
  1898.       message_number = current-1;
  1899. ***************
  1900. *** 420,426 ****
  1901.         line = 0;
  1902.         lines = headers[message_number]->lines;
  1903.   
  1904. !       while ((line_len = mail_gets(buffer, LONG_STRING, mailfile)) && line < lines) {
  1905.       
  1906.           if(buffer[line_len - 1] == '\n') line++;
  1907.   
  1908. --- 426,433 ----
  1909.         line = 0;
  1910.         lines = headers[message_number]->lines;
  1911.   
  1912. !       while ((line_len = mail_gets(buffer, VERY_LONG_STRING, mailfile)) &&
  1913. !         line < lines) {
  1914.       
  1915.           if(buffer[line_len - 1] == '\n') line++;
  1916.   
  1917.  
  1918. Index: src/read_rc.c
  1919. Prereq: 5.16
  1920. *** ../elm2.4/src/read_rc.c    Sun May 16 16:59:20 1993
  1921. --- src/read_rc.c    Sun Aug 22 22:58:06 1993
  1922. ***************
  1923. *** 1,8 ****
  1924.   
  1925. ! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.16 1993/05/16 20:59:14 syd Exp $";
  1926.   
  1927.   /*******************************************************************************
  1928. !  *  The Elm Mail System  -  $Revision: 5.16 $   $State: Exp $
  1929.    *
  1930.    *            Copyright (c) 1988-1992 USENET Community Trust
  1931.    *            Copyright (c) 1986,1987 Dave Taylor
  1932. --- 1,8 ----
  1933.   
  1934. ! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.25 1993/08/23 02:58:04 syd Exp $";
  1935.   
  1936.   /*******************************************************************************
  1937. !  *  The Elm Mail System  -  $Revision: 5.25 $   $State: Exp $
  1938.    *
  1939.    *            Copyright (c) 1988-1992 USENET Community Trust
  1940.    *            Copyright (c) 1986,1987 Dave Taylor
  1941. ***************
  1942. *** 14,19 ****
  1943. --- 14,100 ----
  1944.    *
  1945.    *******************************************************************************
  1946.    * $Log: read_rc.c,v $
  1947. +  * Revision 5.25  1993/08/23  02:58:04  syd
  1948. +  * Call to expand_env for pager should be call to do_expand_env.
  1949. +  * temp_dir not initialized.
  1950. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1951. +  *
  1952. +  * Revision 5.24  1993/08/10  18:49:32  syd
  1953. +  * When an environment variable was given as the tmpdir definition the src
  1954. +  * and dest overlapped in expand_env.  This made elm produce a garbage
  1955. +  * expansion because expand_env cannot cope with overlapping src and
  1956. +  * dest.  I added a new variable raw_temp_dir to keep src and dest not to
  1957. +  * overlap.
  1958. +  * From: Jukka Ukkonen <ukkonen@csc.fi>
  1959. +  *
  1960. +  * Revision 5.23  1993/08/03  19:28:39  syd
  1961. +  * Elm tries to replace the system toupper() and tolower() on current
  1962. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1963. +  * collide during linking with routines in isctype.o.  This patch adds
  1964. +  * a Configure test to determine whether replacements are really needed
  1965. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1966. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1967. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1968. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1969. +  * were dropped.
  1970. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1971. +  *
  1972. +  * Revision 5.22  1993/08/03  18:57:21  syd
  1973. +  * default_weedlist() can't use pmalloc, because weedout() calls free when
  1974. +  * it encounters *clear-weed-list*.
  1975. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1976. +  *
  1977. +  * Revision 5.21  1993/08/03  18:55:42  syd
  1978. +  * Spaces in weedout strings wasn't preserved ("From " became "From").
  1979. +  * From: Jan.Djarv@sa.erisoft.se (Jan Djarv)
  1980. +  *
  1981. +  * Revision 5.20  1993/07/20  02:41:24  syd
  1982. +  * Three changes to expand_env() in src/read_rc.c:  make it non-destructive,
  1983. +  * have it return an error code instead of bailing out, and add a buffer
  1984. +  * size argument to avoid overwritting the destination.  The first is to
  1985. +  * avoid all of the gymnastics Elm needed to go through (and occasionally
  1986. +  * forgot to go through) to protect the value handed to expand_env().
  1987. +  * The second is because expand_env() was originally written to support
  1988. +  * "elmrc" and bailing out was a reasonable thing to do there -- but not
  1989. +  * in the other places where it has since been used.  The third is just
  1990. +  * a matter of practicing safe source code.
  1991. +  *
  1992. +  * This patch changes all invocations to expand_env() to eliminate making
  1993. +  * temporary copies (now that the routine is non-destructive) and to pass
  1994. +  * in a destination length.  Since expand_env() no longer bails out on
  1995. +  * error, a do_expand_env() routine was added to src/read_rc.c handle
  1996. +  * this.  Moreover, the error message now gives some indication of what
  1997. +  * the problem is rather than just saying "can't expand".
  1998. +  *
  1999. +  * Gratitous change to src/editmsg.c renaming filename variables to
  2000. +  * clarify the purpose.
  2001. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2002. +  *
  2003. +  * Revision 5.19  1993/06/10  03:08:38  syd
  2004. +  * I have been repetedly crashing elm 2.4.22 until I discovered that a
  2005. +  * test for failing to open the system elmrc file is mising. This could
  2006. +  * usefully be added in read_rc.c. Version info and patch follows:
  2007. +  * From: "C.R. Ritson" <C.R.Ritson@newcastle.ac.uk>
  2008. +  *
  2009. +  * Revision 5.18  1993/06/10  03:07:39  syd
  2010. +  * This fixes a bug in the MIME code.  Include_Part() uses expand_env()
  2011. +  * to expand the include file name, but since expand_env() is destructive
  2012. +  * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
  2013. +  * header can contain a bogus value.  The easy fix would be a one-line
  2014. +  * hack to Include_Part to use a temporary buffer.  This patch does not
  2015. +  * implement the easy fix.  *Every* place expand_env() is used, its side
  2016. +  * effects cause problems.  I think the right fix is to make expand_env()
  2017. +  * non-destructive (i.e. have it duplicate the input to a temporary buffer
  2018. +  * and work from there).  The attached patch modifies expand_env() in
  2019. +  * that manner, and eliminates all of the `copy to a temporary buffer'
  2020. +  * calls that precede it throughout elm.
  2021. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2022. +  *
  2023. +  * Revision 5.17  1993/06/10  02:55:34  syd
  2024. +  * Write options to elmrc even if their values are empty strings.
  2025. +  * Rationalize code that reads and writes weedouts and alternates.
  2026. +  * From: chip%fin@myrddin.sybus.com
  2027. +  *
  2028.    * Revision 5.16  1993/05/16  20:59:14  syd
  2029.    * fix not closing file
  2030.    * From: Syd
  2031. ***************
  2032. *** 172,187 ****
  2033.   **/
  2034.   
  2035.   #define SAVE_OPTS
  2036. - #include <ctype.h>
  2037.   #include "headers.h"
  2038.   #include "save_opts.h"
  2039.   #include "s_elm.h"
  2040.   #include <errno.h>
  2041.   
  2042. - #ifdef BSD
  2043. - #undef tolower
  2044. - #endif
  2045.   extern opts_menu *find_cfg_opts();
  2046.   extern int errno;
  2047.   
  2048. --- 253,263 ----
  2049. ***************
  2050. *** 203,208 ****
  2051. --- 279,299 ----
  2052.   static int lineno = 0;
  2053.   static int errors = 0;
  2054.   
  2055. + static void
  2056. + do_expand_env(descr, dest, src, destlen)
  2057. +     char    *descr, *dest, *src;
  2058. +     unsigned    destlen;
  2059. + {
  2060. +     if (expand_env(dest, src, destlen) != 0) {
  2061. +     printf(catgets(elm_msg_cat, ElmSet, ElmCannotInitErrorExpanding,
  2062. +         "\r\nCannot initialize \"%s\" - error expanding \"%s\".\r\n"),
  2063. +         descr, src);
  2064. +     leave(0);
  2065. +     }
  2066. + }
  2067.   read_rc_file()
  2068.   {
  2069.       /** this routine does all the actual work of reading in the
  2070. ***************
  2071. *** 237,270 ****
  2072.   
  2073.   
  2074.       strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
  2075. !     strcpy(temp, raw_shell);
  2076. !     expand_env(shell, temp);
  2077.   
  2078.       strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
  2079. !     strcpy(temp, raw_pager);
  2080. !     expand_env(pager, temp);
  2081. !     strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  2082.   
  2083. !     strcpy(temp_dir, ((cp = getenv("TMPDIR")) == NULL)? default_temp:cp);
  2084.       if (temp_dir[strlen (temp_dir)-1] != '/')
  2085. !                 strcat(temp_dir, "/");
  2086.   
  2087.       strcpy(alternative_editor, raw_editor);
  2088. !     strcpy(temp, raw_editor);
  2089. !     expand_env(editor, temp);
  2090.   
  2091.       strcpy(raw_printout, default_printout);
  2092. !     strcpy(temp, raw_printout);
  2093. !     expand_env(printout, temp);
  2094.   
  2095.       sprintf(raw_folders, "~/%s", default_folders);
  2096. !     strcpy(temp, raw_folders);
  2097. !     expand_env(folders, temp);
  2098.   
  2099.       sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
  2100. !     strcpy(temp, raw_calendar_file);
  2101. !     expand_env(calendar_file, temp);
  2102.   
  2103.       strcpy(e_editor, emacs_editor);
  2104.       strcpy(v_editor, default_editor);
  2105. --- 328,356 ----
  2106.   
  2107.   
  2108.       strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
  2109. !     do_expand_env("shell", shell, raw_shell, sizeof(shell));
  2110.   
  2111.       strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
  2112. !     do_expand_env("pager", pager, raw_pager, sizeof(pager));
  2113.   
  2114. !     strcpy(raw_temp_dir, (cp = getenv("TMPDIR")) ? cp : default_temp);
  2115. !     do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
  2116.       if (temp_dir[strlen (temp_dir)-1] != '/')
  2117. !         strcat(temp_dir, "/");
  2118.   
  2119. +     strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
  2120.       strcpy(alternative_editor, raw_editor);
  2121. !     do_expand_env("editor", editor, raw_editor, sizeof(editor));
  2122.   
  2123.       strcpy(raw_printout, default_printout);
  2124. !     do_expand_env("printout", printout, raw_printout, sizeof(printout));
  2125.   
  2126.       sprintf(raw_folders, "~/%s", default_folders);
  2127. !     do_expand_env("folders", folders, raw_folders, sizeof(folders));
  2128.   
  2129.       sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
  2130. !     do_expand_env("calendar_file", calendar_file, raw_calendar_file,
  2131. !         sizeof(calendar_file));
  2132.   
  2133.       strcpy(e_editor, emacs_editor);
  2134.       strcpy(v_editor, default_editor);
  2135. ***************
  2136. *** 306,312 ****
  2137.   
  2138.         fflush(stdout);
  2139.         ch=getchar();
  2140. !       if (isupper(ch)) ch = tolower(ch);
  2141.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  2142.           ch = *def_ans_no;
  2143.   
  2144. --- 392,398 ----
  2145.   
  2146.         fflush(stdout);
  2147.         ch=getchar();
  2148. !       ch = tolower(ch);
  2149.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  2150.           ch = *def_ans_no;
  2151.   
  2152. ***************
  2153. *** 332,339 ****
  2154.   
  2155.       /* try system-wide rc file */
  2156.       file = fopen(system_rc_file, "r");
  2157. !     do_rc(file, SYSTEM_RC);
  2158. !     fclose(file);
  2159.   
  2160.       /* Look for the elmrc file */
  2161.       sprintf(filename, "%s/%s", home, elmrcfile);
  2162. --- 418,427 ----
  2163.   
  2164.       /* try system-wide rc file */
  2165.       file = fopen(system_rc_file, "r");
  2166. !     if ( file != NULL ) {
  2167. !       do_rc(file, SYSTEM_RC);
  2168. !       fclose(file);
  2169. !     }
  2170.   
  2171.       /* Look for the elmrc file */
  2172.       sprintf(filename, "%s/%s", home, elmrcfile);
  2173. ***************
  2174. *** 381,416 ****
  2175.           }
  2176.           *t = '\0';
  2177.       }
  2178. !     strcpy(buffer, raw_folders);
  2179. !     expand_env(folders, buffer);
  2180. !     strcpy(buffer, temp_dir);
  2181. !     expand_env(temp_dir, buffer);
  2182. !     if (temp_dir[strlen (temp_dir)-1] != '/')
  2183. !         strcat(temp_dir, "/");
  2184.   
  2185. !     strcpy(buffer, raw_shell);
  2186. !     expand_env(shell, buffer);
  2187.   
  2188. !     strcpy(buffer, raw_editor);
  2189. !     expand_env(editor, buffer);
  2190.   
  2191. !     strcpy(buffer, raw_calendar_file);
  2192. !     expand_env(calendar_file, buffer);
  2193.   
  2194. !     strcpy(buffer, raw_printout);
  2195. !     expand_env(printout, buffer);
  2196.   
  2197. !     strcpy(buffer, raw_pager);
  2198. !     expand_env(pager, buffer);
  2199.       if (equal(pager, "builtin+") || equal(pager, "internal+"))
  2200.           clear_pages++;
  2201.   
  2202. !     strcpy(buffer, raw_local_signature);
  2203. !     expand_env(local_signature, buffer);
  2204. !     strcpy(buffer, raw_remote_signature);
  2205. !     expand_env(remote_signature, buffer);
  2206.   
  2207.       if (equal(local_signature, remote_signature) &&
  2208.           (equal(shift_lower(local_signature), "on") ||
  2209. --- 469,497 ----
  2210.           }
  2211.           *t = '\0';
  2212.       }
  2213. !     do_expand_env("folders", folders, raw_folders, sizeof(folders));
  2214.   
  2215. !     do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
  2216. !       if (temp_dir[strlen (temp_dir)-1] != '/')
  2217. !           strcat(temp_dir, "/");
  2218. !   
  2219. !     do_expand_env("shell", shell, raw_shell, sizeof(shell));
  2220.   
  2221. !     do_expand_env("editor", editor, raw_editor, sizeof(editor));
  2222.   
  2223. !     do_expand_env("calendar_file", calendar_file, raw_calendar_file,
  2224. !         sizeof(calendar_file));
  2225.   
  2226. !     do_expand_env("printout", printout, raw_printout, sizeof(printout));
  2227.   
  2228. !     do_expand_env("pager", pager, raw_pager, sizeof(pager));
  2229.       if (equal(pager, "builtin+") || equal(pager, "internal+"))
  2230.           clear_pages++;
  2231.   
  2232. !     do_expand_env("local_signature", local_signature,
  2233. !         raw_local_signature, sizeof(local_signature));
  2234. !     do_expand_env("remote_signature", remote_signature,
  2235. !         raw_remote_signature, sizeof(remote_signature));
  2236.   
  2237.       if (equal(local_signature, remote_signature) &&
  2238.           (equal(shift_lower(local_signature), "on") ||
  2239. ***************
  2240. *** 477,483 ****
  2241.   
  2242.         fflush(stdout);
  2243.         ch=getchar();
  2244. !       if (isupper(ch)) ch = tolower(ch);
  2245.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  2246.           ch = *def_ans_yes;
  2247.   
  2248. --- 558,564 ----
  2249.   
  2250.         fflush(stdout);
  2251.         ch=getchar();
  2252. !       ch = tolower(ch);
  2253.         if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
  2254.           ch = *def_ans_yes;
  2255.   
  2256. ***************
  2257. *** 510,517 ****
  2258.         strcpy(raw_recvdmail, default_recvdmail);
  2259.       }
  2260.   
  2261. !     strcpy(buffer, raw_recvdmail);
  2262. !     expand_env(recvd_mail, buffer);
  2263.   
  2264.       if(metachar(recvd_mail[0])) {
  2265.         strcpy(buffer, &recvd_mail[1]);
  2266. --- 591,598 ----
  2267.         strcpy(raw_recvdmail, default_recvdmail);
  2268.       }
  2269.   
  2270. !     do_expand_env("recvd_mail", recvd_mail, raw_recvdmail,
  2271. !         sizeof(recvd_mail));
  2272.   
  2273.       if(metachar(recvd_mail[0])) {
  2274.         strcpy(buffer, &recvd_mail[1]);
  2275. ***************
  2276. *** 523,530 ****
  2277.         sprintf(sent_mail, default_sentmail);
  2278.       }
  2279.   
  2280. !     strcpy(buffer, raw_sentmail);
  2281. !     expand_env(sent_mail, buffer);
  2282.   
  2283.       if(metachar(sent_mail[0])) {
  2284.         strcpy(buffer, &sent_mail[1]);
  2285. --- 604,610 ----
  2286.         sprintf(sent_mail, default_sentmail);
  2287.       }
  2288.   
  2289. !     do_expand_env("sent_mail", sent_mail, raw_sentmail, sizeof(sent_mail));
  2290.   
  2291.       if(metachar(sent_mail[0])) {
  2292.         strcpy(buffer, &sent_mail[1]);
  2293. ***************
  2294. *** 744,783 ****
  2295.   {
  2296.       /** This routine is called with a list of headers to weed out.   **/
  2297.   
  2298. !     char *strptr, *header;
  2299. !     register int i, len;
  2300.   
  2301.       strptr = string;
  2302.   
  2303. !     while ((header = strtok(strptr, "\t ,\"'")) != NULL) {
  2304. !       if (strlen(header) > 0) {
  2305. !         if (! istrcmp(header, "*end-of-user-headers*")) break;
  2306. !         if (! istrcmp(header, "*clear-weed-list*")) {
  2307. !           weedlist[0] = "*end-of-defaults*";
  2308. !           weedcount = 1;
  2309. !         }
  2310. !         if (weedcount > MAX_IN_WEEDLIST) {
  2311. !           printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
  2312. !         "Too many weed headers!  Leaving...\n\r"));
  2313. !           exit(1);
  2314. !         }
  2315. !         if ((weedlist[weedcount] = pmalloc(strlen(header) + 1)) == NULL) {
  2316. !           printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
  2317. !         "Too many weed headers! Out of memory!  Leaving...\n\r"));
  2318. !           exit(1);
  2319. !         }
  2320.   
  2321. !         for (i=0, len = strlen(header); i< len; i++)
  2322. !           if (header[i] == '_') header[i] = ' ';
  2323.   
  2324. !             if(!matches_weedlist(header)) {
  2325. !           strcpy(weedlist[weedcount], header);
  2326. !           weedcount++;
  2327. !         }
  2328. ! /* since this used both for system defaults and user's */
  2329. !         if (equal(header, "*end-of-defaults*")) break;
  2330.         }
  2331. !       strptr = NULL;
  2332.       }
  2333.   }
  2334.   
  2335. --- 824,872 ----
  2336.   {
  2337.       /** This routine is called with a list of headers to weed out.   **/
  2338.   
  2339. !     char *strptr, *header, *p;
  2340. !     int finished;
  2341.   
  2342. +     finished = FALSE;
  2343.       strptr = string;
  2344. +     while (!finished && (header = strtokq(strptr, "\t ,", TRUE)) != NULL) {
  2345. +       strptr = NULL;
  2346.   
  2347. !       if (!*header)
  2348. !         continue;
  2349. !       for (p = header; *p; ++p) {
  2350. !         if (*p == '_')
  2351. !           *p = ' ';
  2352. !       }
  2353.   
  2354. !       if (! istrcmp(header, "*end-of-user-headers*"))
  2355. !         break;
  2356.   
  2357. !       if (! istrcmp(header, "*end-of-defaults*"))
  2358. !         finished = TRUE;
  2359. !       if (! istrcmp(header, "*clear-weed-list*")) {
  2360. !         while (weedcount)
  2361. !           free(weedlist[--weedcount]);
  2362. !         header = "*end-of-defaults*";
  2363.         }
  2364. !       if (matches_weedlist(header))
  2365. !         continue;
  2366. !       if (weedcount > MAX_IN_WEEDLIST) {
  2367. !         printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
  2368. !            "Too many weed headers!  Leaving...\n\r"));
  2369. !         exit(1);
  2370. !       }
  2371. !       if ((p = malloc(strlen(header) + 1)) == NULL) {
  2372. !         printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
  2373. !            "Too many weed headers!  Out of memory!  Leaving...\n\r"));
  2374. !         exit(1);
  2375. !       }
  2376. !       strcpy(p, header);
  2377. !       weedlist[weedcount++] = p;
  2378.       }
  2379.   }
  2380.   
  2381. ***************
  2382. *** 840,846 ****
  2383.   
  2384.       for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
  2385.         if ((weedlist[weedcount] = 
  2386. !           pmalloc(strlen(default_list[weedcount]) + 1)) == NULL) {
  2387.           printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
  2388.           "\nNot enough memory for default weedlist. Leaving.\n"));
  2389.           leave(1);
  2390. --- 929,935 ----
  2391.   
  2392.       for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
  2393.         if ((weedlist[weedcount] = 
  2394. !           malloc(strlen(default_list[weedcount]) + 1)) == NULL) {
  2395.           printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
  2396.           "\nNot enough memory for default weedlist. Leaving.\n"));
  2397.           leave(1);
  2398. ***************
  2399. *** 883,892 ****
  2400.       for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
  2401.         if (buffer[i] == '_')
  2402.           word1[i] = '-';
  2403. -       else if (isupper(buffer[i]))
  2404. -         word1[i] = tolower(buffer[i]);
  2405.         else
  2406. !         word1[i] = buffer[i];
  2407.   
  2408.       word1[i++] = '\0';    /* that's the first word! */
  2409.   
  2410. --- 972,979 ----
  2411.       for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
  2412.         if (buffer[i] == '_')
  2413.           word1[i] = '-';
  2414.         else
  2415. !         word1[i] = tolower(buffer[i]);
  2416.   
  2417.       word1[i++] = '\0';    /* that's the first word! */
  2418.   
  2419. ***************
  2420. *** 913,967 ****
  2421.   
  2422.   }
  2423.   
  2424. ! expand_env(dest, buffer)
  2425. ! char *dest, *buffer;
  2426.   {
  2427. !     /** expand possible metacharacters in buffer and then copy
  2428. !         to dest... 
  2429.   
  2430. !         BEWARE!! Because strtok() is used on buffer, buffer may be changed.
  2431.   
  2432. !         This routine knows about "~" being the home directory,
  2433. !         and "$xxx" being an environment variable.
  2434. !     **/
  2435.   
  2436. !     char  *word, *string, next_word[SLEN];
  2437. !     
  2438. !     if (buffer[0] == '/') {
  2439. !       dest[0] = '/';
  2440. !       dest[1] = '\0';
  2441. ! /* Added for Apollos - handle //node */
  2442. !       if (buffer[1] == '/') {
  2443. !         dest[1] = '/';
  2444. !         dest[2] = '\0';
  2445. !       }
  2446. !     }
  2447. !     else
  2448. !       dest[0] = '\0';
  2449.   
  2450. !     string = (char *) buffer;
  2451.   
  2452. !     while ((word = strtok(string, "/")) != NULL) {
  2453. !       if (word[0] == '$') {
  2454. !         next_word[0] = '\0';
  2455. !         if (getenv((char *) (word + 1)) != NULL)
  2456. !         strcpy(next_word, getenv((char *) (word + 1)));
  2457. !         if (strlen(next_word) == 0)
  2458. !           leave(printf(catgets(elm_msg_cat, ElmSet, ElmCantExpandEnvVar,
  2459. !             "\n\rCan't expand environment variable '%s'.\n\r"),
  2460. !             word));
  2461. !       }
  2462. !       else if (word[0] == '~' && word[1] == '\0')
  2463. !         strcpy(next_word, home);
  2464. !       else
  2465. !         strcpy(next_word, word);
  2466.   
  2467. !       sprintf(dest, "%s%s%s", dest, 
  2468. !          (strlen(dest) > 0 && lastch(dest) != '/' ? "/":""),
  2469. !          next_word);
  2470.   
  2471. -       string = (char *) NULL;
  2472.       }
  2473.   }
  2474.   
  2475.   #define on_off(s)    (s == 1? "ON " : "OFF")
  2476. --- 1000,1098 ----
  2477.   
  2478.   }
  2479.   
  2480. ! /*
  2481. !  * expand_env() - Perform environment expansion on a pathname.  Also
  2482. !  * replaces "~" at the front of the path with the user's home directory.
  2483. !  * Environment expansion occurs at the path component boundaries, e.g.
  2484. !  * "/foo/$BAR/baz" is subject to expansion but "/foo/zzz$BAR/baz" is not.
  2485. !  * Returns 0 if expansion successful, -1 if an error occurs (result too
  2486. !  * long, cannot get home directory, or environment expansion failed).
  2487. !  */
  2488. ! expand_env(dest, src, destlen)
  2489. ! char *dest;        /* pointer to space to hold the result    */
  2490. ! char *src;        /* pointer to string to expand        */
  2491. ! unsigned destlen;    /* size of the destination buffer    */
  2492.   {
  2493. !     char envname_buf[SLEN], *envname_front, *expval;
  2494. !     int check_for_env, len, ret;
  2495.   
  2496. !     --destlen;        /* reserve space for trailing '\0' */
  2497. !     ret = 0;        /* assume success */
  2498.   
  2499. !     /*
  2500. !      * Replace "~" at front with user's home directory.
  2501. !      */
  2502. !     if (src[0] == '~' && (src[1] == '\0' || src[1] == '/')) {
  2503. !     if (home[0] == '\0') {
  2504. !         expval = "~";
  2505. !         ret = -1;
  2506. !     } else {
  2507. !         expval = home;
  2508. !     }
  2509. !     if ((len = strlen(expval)) > destlen)
  2510. !         len = destlen;
  2511. !     strfcpy(dest, expval, len+1);
  2512. !     dest += len;
  2513. !     destlen -= len;
  2514. !     ++src;
  2515. !     }
  2516. !     /*
  2517. !      * Copy through the rest, performing $NAME expansion where appropriate.
  2518. !      */
  2519. !     check_for_env = TRUE;
  2520. !     while (destlen > 0 && *src != '\0') {
  2521.   
  2522. !     /*
  2523. !      * Check for "$NAME" at the start of every path component.
  2524. !      */
  2525. !     if (check_for_env && *src == '$') {
  2526.   
  2527. !         /*
  2528. !          * Get the environment parameter name into "envname_buf"
  2529. !          * and advance "src" to the next path component.
  2530. !          */
  2531. !         envname_front = ++src;
  2532. !         if ((len = strcspn(src, "/")) == 0)
  2533. !         len = strlen(src);
  2534. !         src += len;
  2535. !         if (len > sizeof(envname_buf)-1)
  2536. !         len = sizeof(envname_buf)-1;
  2537. !         strfcpy(envname_buf, envname_front, len+1);
  2538. !         /*
  2539. !          * Copy over the environment expansion.  If the environment
  2540. !          * parameter is undefined then copy over unchanged and set
  2541. !          * a fail return status.
  2542. !          */
  2543. !         if ((expval = getenv(envname_buf)) == NULL) {
  2544. !         *dest++ = '$';
  2545. !         --destlen;
  2546. !         expval = envname_buf;
  2547. !         ret = -1;
  2548. !         }
  2549. !         if ((len = strlen(expval)) > destlen)
  2550. !         len = destlen;
  2551. !         strfcpy(dest, expval, len+1);
  2552. !         dest += len;
  2553. !         destlen -= len;
  2554. !         check_for_env = FALSE;
  2555.   
  2556. !     } else {
  2557.   
  2558. !         check_for_env = (*src == '/');
  2559. !         *dest++ = *src++;
  2560. !         --destlen;
  2561.   
  2562.       }
  2563. +     }
  2564. +     *dest = '\0';
  2565. +     if (destlen <= 0)
  2566. +     ret = -1;
  2567. +     return ret;
  2568.   }
  2569.   
  2570.   #define on_off(s)    (s == 1? "ON " : "OFF")
  2571. ***************
  2572. *** 1045,1051 ****
  2573.       register int i, j;
  2574.   
  2575.       for (i=0, j=0; word[i] != '\0'; i++)
  2576. !       mybuffer[j++] = isupper(word[i]) ? tolower(word[i]) : word[i];
  2577.       mybuffer[j] = '\0';
  2578.   
  2579.       return(  (strncmp(mybuffer, "on",   2) == 0) ||
  2580. --- 1176,1182 ----
  2581.       register int i, j;
  2582.   
  2583.       for (i=0, j=0; word[i] != '\0'; i++)
  2584. !       mybuffer[j++] = tolower(word[i]);
  2585.       mybuffer[j] = '\0';
  2586.   
  2587.       return(  (strncmp(mybuffer, "on",   2) == 0) ||
  2588.  
  2589. Index: src/remail.c
  2590. Prereq: 5.10
  2591. *** ../elm2.4/src/remail.c    Tue Apr 20 21:25:47 1993
  2592. --- src/remail.c    Sun Sep 26 21:52:07 1993
  2593. ***************
  2594. *** 1,8 ****
  2595.   
  2596. ! static char rcsid[] = "@(#)$Id: remail.c,v 5.10 1993/04/21 01:25:45 syd Exp $";
  2597.   
  2598.   /*******************************************************************************
  2599. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  2600.    *
  2601.    *            Copyright (c) 1988-1992 USENET Community Trust
  2602.    *            Copyright (c) 1986,1987 Dave Taylor
  2603. --- 1,8 ----
  2604.   
  2605. ! static char rcsid[] = "@(#)$Id: remail.c,v 5.13 1993/09/27 01:51:38 syd Exp $";
  2606.   
  2607.   /*******************************************************************************
  2608. !  *  The Elm Mail System  -  $Revision: 5.13 $   $State: Exp $
  2609.    *
  2610.    *            Copyright (c) 1988-1992 USENET Community Trust
  2611.    *            Copyright (c) 1986,1987 Dave Taylor
  2612. ***************
  2613. *** 14,19 ****
  2614. --- 14,33 ----
  2615.    *
  2616.    *******************************************************************************
  2617.    * $Log: remail.c,v $
  2618. +  * Revision 5.13  1993/09/27  01:51:38  syd
  2619. +  * Add elm_chown to consolidate for Xenix not allowing -1
  2620. +  * From: Syd
  2621. +  *
  2622. +  * Revision 5.12  1993/08/23  03:26:24  syd
  2623. +  * Try setting group id separate from user id in chown to
  2624. +  * allow restricted systems to change group id of file
  2625. +  * From: Syd
  2626. +  *
  2627. +  * Revision 5.11  1993/08/10  18:53:31  syd
  2628. +  * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
  2629. +  * some reads of unitialized memory.
  2630. +  * From: vogt@isa.de
  2631. +  *
  2632.    * Revision 5.10  1993/04/21  01:25:45  syd
  2633.    * I'm using Elm 2.4.21 under Linux.  Linux has no Bourne shell.  Each
  2634.    * user installs her favorite shell as /bin/sh.  I use Bash 1.12.
  2635. ***************
  2636. *** 127,139 ****
  2637.               "Sorry - couldn't open file %s for writing (%s)."),
  2638.             error_description(err));
  2639.         set_error(buffer);
  2640.         return(1);
  2641.       }
  2642.   
  2643.       /** now let's copy the message into the newly opened
  2644.           buffer... **/
  2645.   
  2646. !     chown (filename, userid, groupid);
  2647.   
  2648.   #ifdef MMDF
  2649.       if (strcmp(submitmail, mailer) == 0)
  2650. --- 141,154 ----
  2651.               "Sorry - couldn't open file %s for writing (%s)."),
  2652.             error_description(err));
  2653.         set_error(buffer);
  2654. +       free(filename);
  2655.         return(1);
  2656.       }
  2657.   
  2658.       /** now let's copy the message into the newly opened
  2659.           buffer... **/
  2660.   
  2661. !     (void) elm_chown(filename, userid, groupid);
  2662.   
  2663.   #ifdef MMDF
  2664.       if (strcmp(submitmail, mailer) == 0)
  2665. ***************
  2666. *** 158,163 ****
  2667. --- 173,179 ----
  2668.         set_error(catgets(elm_msg_cat, ElmSet, ElmBounceCancelled,
  2669.           "Bounce of message canceled."));
  2670.         (void) unlink(filename);
  2671. +       free(filename);
  2672.         return(1);
  2673.       }
  2674.   
  2675. ***************
  2676. *** 185,190 ****
  2677. --- 201,208 ----
  2678.       (void) system_call(buffer, 0);
  2679.       set_error(catgets(elm_msg_cat, ElmSet, ElmMailResent, "Mail resent."));
  2680.   
  2681. +         free(filename);
  2682.       return(1);
  2683.   }
  2684.   #ifdef MMDF
  2685.  
  2686.